[PATCH] D139109: [LoopUnswitch] Perform loop unswitching on select instructions

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 23:48:29 PST 2022


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2628
+
+  PHINode *Phi = PHINode::Create(SI->getType(), 2, "", SI);
+  Phi->addIncoming(SI->getTrueValue(), ThenBB);
----------------
mkazantsev wrote:
> This is wrong, you can't insert a Phi before SI if there is another instruction before it. Your insertion point should be smth like block.begin().
I also propose to give this Phi a name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139109



More information about the llvm-commits mailing list