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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 12:56:22 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:261
+      for (unsigned I = 0; I < PHI->getNumIncomingValues(); ++I)
+        Worklist.insert(cast<Instruction>(PHI->getIncomingValue(I)));
+      Worklist.insert(PHI);
----------------
Why do we need to add the phi incoming values to the worklist? Can't this use the same code as bitcast/GEP?

Also, I think it would be good to add a test involving a loop phi, because I think as written, this code might go into infinite recursion in that case.


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