[llvm] [AMDGPU] Restrict promote alloca on pointers across address spaces (PR #119762)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 20 18:49:17 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:
There is no copy across address spaces here, this check is conceptually wrong. You only need to verify the size is compatible. For the final code emission, you'll need to insert no-op casts to get the types to match
https://github.com/llvm/llvm-project/pull/119762
More information about the llvm-commits
mailing list