[PATCH] D26196: AMDGPU: Translate null pointers in private and local addr space

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 1 11:14:01 PDT 2016


arsenm added inline comments.


================
Comment at: lib/CodeGen/TargetInfo.cpp:6957-6958
+
+  llvm::Constant *translateNullPtr(const CodeGen::CodeGenModule &CGM,
+      llvm::Constant *C) const override;
 };
----------------
I was thinking that addrspacecast (generic null) should be valid for all targets, but I guess this saves the trouble of needing to fold out the nulls for the address spaces where null is supposed to be 0


================
Comment at: lib/CodeGen/TargetInfo.cpp:7038
+  auto AS = PT->getAddressSpace();
+  if (CGM.getTarget().getTriple().getArch() != llvm::Triple::amdgcn ||
+    (AS != Ctx.getTargetAddressSpace(LangAS::opencl_local) && AS != 0))
----------------
The amdgcn check should be unnecessary


================
Comment at: lib/CodeGen/TargetInfo.cpp:7039
+  if (CGM.getTarget().getTriple().getArch() != llvm::Triple::amdgcn ||
+    (AS != Ctx.getTargetAddressSpace(LangAS::opencl_local) && AS != 0))
+    return C;
----------------
Shouldn't the 0 be checking lang as::opencl_private? 


https://reviews.llvm.org/D26196





More information about the cfe-commits mailing list