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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 18:53:31 PST 2025


================
@@ -198,3 +198,33 @@ entry:
   %tmp = load ptr addrspace(3), ptr addrspace(5) %alloca, align 8
   ret ptr addrspace(3) %tmp
 }
+
+; Will not vectorize because we're saving a 64-bit pointer from addrspace 0
+; in to two 32 bits pointers of addrspace 5.
+; CHECK-LABEL: define void @alloca_load_store_ptr_mixed_addrspace_ptrvec
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[ALLOCA:%.*]] = alloca <2 x ptr addrspace(5)>, align 8, addrspace(5)
+; CHECK-NEXT:    store ptr undef, ptr addrspace(5) [[ALLOCA]], align 8
+; CHECK-NEXT:    ret void
+;
+define void @alloca_load_store_ptr_mixed_addrspace_ptrvec() {
+entry:
+  %A2 = alloca <2 x ptr addrspace(5)>, align 8, addrspace(5)
+  store  ptr undef, ptr addrspace(5) %A2, align 8
----------------
arsenm wrote:

Should also test with a real value instead of an undef. A test with a constant leaf would be useful too

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


More information about the llvm-commits mailing list