[PATCH] D87149: [InstCombine] erase instructions leading up to unreachable

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 5 08:01:11 PDT 2020


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2805
+  // simple dead code elimination.
+  if (Instruction *Prev = I.getPrevNonDebugInstruction()) {
+    if (!Prev->isEHPad() && isGuaranteedToTransferExecutionToSuccessor(Prev))
----------------
lebedev.ri wrote:
> I think this should be a loop, otherwise it may take extra worklist iterations to catch everything
Right, it should either be a loop, or use
```
eraseInstFromFunction(*Prev);
return &I;
```
to repreorcess the UnreachableInst.


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

https://reviews.llvm.org/D87149



More information about the llvm-commits mailing list