[PATCH] D146225: [AMDGPU] Handle memset users in PromoteAlloca

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 17 07:17:34 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:397
+  const unsigned Size = DL.getTypeStoreSize(AI->getAllocatedType());
+  return I && I->getOperand(0) == AI &&
+         match(I->getOperand(2), m_SpecificInt(Size)) &&
----------------
I null check redundant with one in caller


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:633
         Inst->eraseFromParent();
+      } else if (isa<MemSetInst>(Inst)) {
+        // Ensure the length parameter of the memsets matches the new vector
----------------
Can dyn_cast and use below instead of casting again


================
Comment at: llvm/test/CodeGen/AMDGPU/promote-alloca-memset.ll:31
+  store i64 %val, ptr addrspace(5) %stack
+  ret void
+}
----------------
Pierre-vh wrote:
> jdoerfert wrote:
> > the store of val is dead and SROA drops it. What is the point?
> > Fixing the test and I see reasonable SROA output, what is missing? https://godbolt.org/z/Pacce89fY
> What I'm trying to do here is verify our assumption that the memset is correctly interpreted by SROA & removed. (Which is verified by the presence of the zeroinitializer in the insertelement)
> The interesting check line is the OPT one, the SROA check is just to ensure the alloca is removed after.
Might as well another reload and store to another output


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146225



More information about the llvm-commits mailing list