[llvm] [AMDGPU] Restrict promote alloca on pointers across address spaces (PR #119762)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 25 23:32:18 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's not a property of the pass pipeline, it's a property of the system as a whole. The address space cast from addrspace(5) to 0 is not a no-op cast. If you reload it and use it as the wrong type, it will be an invalid pointer
https://github.com/llvm/llvm-project/pull/119762
More information about the llvm-commits
mailing list