Skip to content

Commit

Permalink
[InstCombine] Don't limit uses in eraseInstFromFunction()
Browse files Browse the repository at this point in the history
eraseInstFromFunction() adds the operands of the erased instructions,
as those might now be dead as well. However, this is limited to
instructions with less than 8 operands.

This check doesn't make a lot of sense to me. As the instruction
gets removed afterwards, I don't see a potential for anything
overly pathological happening here (as we can only add those
operands to the worklist once). The impact on CTMark is in
the noise. We also have the same code in instruction sinking
and don't limit the operand count there.

Differential Revision: https://reviews.llvm.org/D77325
  • Loading branch information
nikic committed Apr 4, 2020
1 parent eec6d87 commit 4ede730
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions llvm/lib/Transforms/InstCombine/InstCombineInternal.h
Expand Up @@ -724,11 +724,10 @@ class LLVM_LIBRARY_VISIBILITY InstCombiner

// Make sure that we reprocess all operands now that we reduced their
// use counts.
if (I.getNumOperands() < 8) {
for (Use &Operand : I.operands())
if (auto *Inst = dyn_cast<Instruction>(Operand))
Worklist.add(Inst);
}
for (Use &Operand : I.operands())
if (auto *Inst = dyn_cast<Instruction>(Operand))
Worklist.add(Inst);

Worklist.remove(&I);
I.eraseFromParent();
MadeIRChange = true;
Expand Down

0 comments on commit 4ede730

Please sign in to comment.