[PATCH] D79738: [AMDGPU] Fix promote alloca which is already vector

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 14:35:25 PDT 2020


rampitec added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:489-490
       StoreInst *SI = cast<StoreInst>(Inst);
-      if (SI->getValueOperand()->getType() == AllocaTy)
+      if (SI->getValueOperand()->getType() == AllocaTy ||
+          SI->getValueOperand()->getType()->isVectorTy())
         break;
----------------
arsenm wrote:
> isAggregateType might be safer?
Array is fine. I am adding a test.


================
Comment at: llvm/test/CodeGen/AMDGPU/vector-alloca-bitcast.ll:363
+  %alloca = alloca <4 x float>, align 16, addrspace(5)
+  %cast = bitcast <4 x float> addrspace(5)* %alloca to <4 x i32> addrspace(5)*
+  store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32> addrspace(5)* %cast
----------------
arsenm wrote:
> What if the load was with a smaller vector, or a bitcast to a different aggregate type/
Loads and stores which are already vector skipped by this patch (smaller vector included).
Test for different array type bitcast is added. Test with cast to struct is added.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79738/new/

https://reviews.llvm.org/D79738





More information about the llvm-commits mailing list