[llvm] [AMDGPU] Restrict promote alloca on pointers across address spaces (PR #119762)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 08:21:19 PST 2024


================
@@ -674,7 +674,17 @@ static bool isSupportedAccessType(FixedVectorType *VecTy, Type *AccessTy,
   //
   // We could handle more complicated cases, but it'd make things a lot more
   // complicated.
-  if (isa<FixedVectorType>(AccessTy)) {
+
+  // If both are pointer types, verify if they are compatible to copy across
+  // address spaces.
+  bool canCopyAcrossAddressSpaces = true;
+  if (AccessTy->isPtrOrPtrVectorTy() && VecTy->isPtrOrPtrVectorTy()) {
+    if (DL.getPointerSize(AccessTy->getPointerAddressSpace()) !=
+        DL.getPointerSize(VecTy->getPointerAddressSpace()))
+      canCopyAcrossAddressSpaces = false;
+  }
----------------
arsenm wrote:

It may be illegal type punning but you don't have the context. It's just bytes 

https://github.com/llvm/llvm-project/pull/119762


More information about the llvm-commits mailing list