[PATCH] D87149: [InstCombine] erase instructions leading up to unreachable
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 06:54:04 PDT 2020
spatel 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)) {
----------------
nikic wrote:
> 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.
Yes, I'm not seeing a way to get bogus IR (eg, that references itself) into here unless it's truly in a block that can't be reached from entry. I'll remove the check - the assert already exists in eraseInstFromFunction().
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87149/new/
https://reviews.llvm.org/D87149
More information about the llvm-commits
mailing list