[PATCH] D140599: AMDGPU: Promote array alloca if used by memmove/memcpy
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 8 17:54:37 PST 2023
arsenm added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:502
+
+ auto getPointerIndexOfAlloca = [&](Value *Ptr) -> ConstantInt * {
+ GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Ptr);
----------------
[=]?
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:593-595
+ case Intrinsic::memcpy:
+ case Intrinsic::memcpy_inline:
+ case Intrinsic::memmove: {
----------------
probably should dyn_cast to MemIntrinsicInst here to defend agains these becoming out of sync
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:611
+ Type *VecPtrTy = VectorTy->getPointerTo(Alloca->getAddressSpace());
+ Value *BitCast = Builder.CreateBitCast(Alloca, VecPtrTy);
+ Value *VecValue = Builder.CreateLoad(VectorTy, BitCast);
----------------
No reason to care about type pointers anymore
================
Comment at: llvm/test/CodeGen/AMDGPU/promote-alloca-array-aggregate.ll:219
+
+declare void @llvm.memcpy.p5i8.p5i8.i32(ptr addrspace(5) nocapture writeonly, ptr addrspace(5) nocapture readonly, i32, i1 immarg)
+declare void @llvm.memmove.p5i8.p5i8.i32(ptr addrspace(5) nocapture writeonly, ptr addrspace(5) nocapture readonly, i32, i1 immarg)
----------------
Needs tests for the different address space cases you mentioned in the todo
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140599/new/
https://reviews.llvm.org/D140599
More information about the llvm-commits
mailing list