[PATCH] D136201: [InstCombine] Replace alloca with phi uses

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 14:51:05 PDT 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:260-263
+    } else if (auto *PHI = dyn_cast<PHINode>(Inst)) {
+      for (unsigned int I = 0; I < PHI->getNumOperands(); ++I)
+        Worklist.insert(cast<Instruction>(PHI->getOperand(I)));
+      Worklist.insert(PHI);
----------------
Maybe in a separate patch, but if you're touching this, might as well handle select too


================
Comment at: llvm/test/Transforms/InstCombine/replace-alloca-phi.ll:1
+; RUN: opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -passes=instcombine -S -o - %s | FileCheck %s
+
----------------
Don't need the target here; it just requires the target to be built


================
Comment at: llvm/test/Transforms/InstCombine/replace-alloca-phi.ll:4
+; CHECK-LABEL: @remove_alloca
+define i8 @remove_alloca(i1 %flag, i32 %idx, [32 x i8] addrspace(4)* align 8 %arg) {
+entry:
----------------
No checks?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136201



More information about the llvm-commits mailing list