rjmccall added inline comments.

================
Comment at: clang/lib/CodeGen/CGCall.cpp:2556-2563
+      // Restrict qualified HIP pointers that were coerced to global pointers
+      // can be marked with the noalias attribute.
+      if (isCoercedHIPGlobalPointer(*this, getLangOpts(), ArgI, Ty) &&
+          Arg->getType().isRestrictQualified()) {
+        auto AI = cast<llvm::Argument>(FnArgs[FirstIRArg]);
+        AI->addAttr(llvm::Attribute::NoAlias);
+      }
----------------
hliao wrote:
> yaxunl wrote:
> > hliao wrote:
> > > I don't think we need to check pointer address and/or HIP specific. As 
> > > the generic argument processing, if the original type has any qualifiers, 
> > > the coerced type (if it has a single value as the original parameter) 
> > > should have those qualifiers as well. Here, we not only miss `restrict` 
> > > but also alignment, `nonnull`, and etc. It should be fixed as a generic 
> > > case instead of a target- or language-specific one.
> > I agree we should migrate other argument properties for promoted 
> > pointer-type kernel arg for HIP, and that should be possible since other 
> > than the address space change, the type is the same.
> > 
> > However, I am not sure if we can do that for coerced function arguments in 
> > general. It may not even be pointer any more.
> If the coerced type is still a pointer but diffs on the element type, address 
> space, or others. They should share the same qualifiers for pointers.
If the parameter type is `restrict`-qualified and there's a single IR argument 
of pointer type, you should be able to apply `NoAlias`, regardless of coercion, 
in all language modes.  You can just hoist that out of the "trivial case" block.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79213/new/

https://reviews.llvm.org/D79213



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to