[llvm] 4ede730 - [InstCombine] Don't limit uses in eraseInstFromFunction()

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 4 09:37:42 PDT 2020


Author: Nikita Popov
Date: 2020-04-04T18:37:30+02:00
New Revision: 4ede730096813a9cb901b92fdd3670813cdc5bc1

URL: https://github.com/llvm/llvm-project/commit/4ede730096813a9cb901b92fdd3670813cdc5bc1
DIFF: https://github.com/llvm/llvm-project/commit/4ede730096813a9cb901b92fdd3670813cdc5bc1.diff

LOG: [InstCombine] Don't limit uses in eraseInstFromFunction()

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

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineInternal.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index f21c7d14bdea..3879c245bc60 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -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;


        


More information about the llvm-commits mailing list