================
@@ -446,10 +446,18 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : 
public TargetInfo {
   // value ~0.
   uint64_t getNullPointerValue(LangAS AS) const override {
     // FIXME: Also should handle region.
-    return (AS == LangAS::opencl_local || AS == LangAS::opencl_private ||
-            AS == LangAS::sycl_local || AS == LangAS::sycl_private)
-               ? ~0
-               : 0;
+    // Check language-specific address spaces
+    if (AS == LangAS::opencl_local || AS == LangAS::opencl_private ||
+        AS == LangAS::sycl_local || AS == LangAS::sycl_private)
+      return ~0;
+    // Also check target address spaces that map to local or private
+    if (isTargetAddressSpace(AS)) {
+      unsigned TargetAS = toTargetAddressSpace(AS);
+      if (TargetAS == llvm::AMDGPUAS::LOCAL_ADDRESS ||
+          TargetAS == llvm::AMDGPUAS::PRIVATE_ADDRESS)
+        return ~0;
----------------
shiltian wrote:

Honestly, it might not be a good idea. What return type do you expect to use? 
An `APInt`? Here it is front end, so we know that those more-than-64-bit 
pointers will not be used (at least for now) as a real pointer, so we can still 
assume `uint64_t`, but when it comes to `AMDGPUAddrSpace.h`, it is different.

https://github.com/llvm/llvm-project/pull/175610
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to