Instead of creating readnone attributes on each parameter of
a function it's better to put just memory(none) which was recently
introduced.
See https://reviews.llvm.org/
D135780
Co-authored by: Zou, Feng <feng.zou@intel.com>
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Gbp-Pq: Name 0014-Backport-to-15-Put-memory-none-attribute-instead-of-.patch
if (isFuncNoUnwind())
F->addFnAttr(Attribute::NoUnwind);
if (isFuncReadNone(UnmangledName))
- for (llvm::Argument &Arg : F->args())
- if (Arg.getType()->isPointerTy())
- Arg.addAttr(Attribute::ReadNone);
+ F->setDoesNotAccessMemory();
}
auto Args = transValue(BC->getArgValues(), F, BB);
SPIRVDBG(dbgs() << "[transOCLBuiltinFromExtInst] Function: " << *F
Func->setCallingConv(CallingConv::SPIR_FUNC);
Func->addFnAttr(Attribute::NoUnwind);
Func->addFnAttr(Attribute::WillReturn);
- for (llvm::Argument &Arg : Func->args())
- if (Arg.getType()->isPointerTy())
- Arg.addAttr(Attribute::ReadNone);
+ Func->setDoesNotAccessMemory();
}
// Collect instructions in these containers to remove them later.
attributes #0 = { norecurse "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="test.cpp" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" }
-; CHECK-LLVM-OCL: attributes #1 = { nounwind willreturn }
+; CHECK-LLVM-OCL: attributes #1 = { nounwind readnone willreturn }
!llvm.module.flags = !{!0}
!opencl.spir.version = !{!1}