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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 07:07:09 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:392
+static bool isSupportedMemset(Instruction *I, AllocaInst *AI,
+                              unsigned AllocaSize) {
+  using namespace PatternMatch;
----------------
I'd expect the input to be the MemSetInst and the dyn_cast would be on the caller side. Also, use TypeSize?


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:398
+  return MSI && MSI->getOperand(0) == AI &&
+         match(MSI->getOperand(2), m_SpecificInt(AllocaSize)) &&
+         match(MSI->getOperand(3), m_Zero());
----------------
Move the size query here?


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:503
 
+    if (isSupportedMemset(Inst, Alloca, DL.getTypeSizeInBits(AllocaTy) / 8)) {
+      WorkList.push_back(Inst);
----------------
getTypeStoreSize?


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:637
+        cast<IntrinsicInst>(Inst)->setOperand(
+            2, Builder.getInt64(DL.getTypeSizeInBits(VectorTy) / 8));
       } else {
----------------
store size


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