[PATCH] D87149: [InstCombine] erase instructions leading up to unreachable
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 05:47:51 PDT 2020
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2806
+ Instruction *Prev = I.getPrevNonDebugInstruction();
+ if (Prev && Prev->use_empty() && !Prev->isEHPad() &&
+ isGuaranteedToTransferExecutionToSuccessor(Prev)) {
----------------
lebedev.ri wrote:
> Is there any testcase with non-empty use list?
> I'd think we could RAUW it with `undef`.
I don't see how the last instruction can have a non-empty use-list if followed by unreachable and not part of a properly unreachable block (which is ensured by instcombine early). I think it can be an assert.
================
Comment at: llvm/test/Transforms/InstCombine/assume.ll:2
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -instcombine -S | FileCheck %s
+; RUN: opt < %s -instcombine -S --instcombine-max-iterations=2 | FileCheck %s
----------------
This should be `-instcombine-infinite-loop-threshold=2`. Otherwise InstCombine will just stop after two iterations without performing further folds -- but we may not see that easily.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87149/new/
https://reviews.llvm.org/D87149
More information about the llvm-commits
mailing list