yaxunl added inline comments.

================
Comment at: clang/lib/CodeGen/CGCall.cpp:2268
+  return LangOpts.HIP && isa<llvm::PointerType>(ArgI.getCoerceToType()) &&
+         ArgI.getCoerceToType()->getPointerAddressSpace() == 1 &&
+         CGF.ConvertType(Ty)->getPointerAddressSpace() == 0 &&
----------------
let's use getContext().getTargetAddressSpace(LangAS::Default) for addrspace 0 
and getContext().getTargetAddressSpace(LangAS::cuda_device) for addrspace 1



================
Comment at: clang/lib/CodeGen/CGCall.cpp:2270
+         CGF.ConvertType(Ty)->getPointerAddressSpace() == 0 &&
+         ArgI.getCoerceToType()->getPointerElementType() ==
+             CGF.ConvertType(Ty)->getPointerElementType();
----------------
For struct containing pointers, we do recursive coercing 

https://github.com/llvm/llvm-project/blob/master/clang/lib/CodeGen/TargetInfo.cpp#L8224

So solely compare element type will fail. We need to add a test case for struct 
containing pointer, and we need to have a recursive comparison in a similar way 
as above code.


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