[PATCH] D77325: [InstCombine] Don't limit operands in eraseInstFromFunction()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 11:56:01 PDT 2020


nikic created this revision.
nikic added reviewers: spatel, lebedev.ri.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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 <http://llvm-compile-time-tracker.com/compare.php?from=50a3e8738a90cfd4915b24c33782cf6a87216b78&to=35a84b2c61ed5e0b0df499a9e4f6053ca7fbaec7&stat=instructions>. We also have the same code in instruction sinking and don't limit the operand count there.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77325

Files:
  lib/Transforms/InstCombine/InstCombineInternal.h


Index: lib/Transforms/InstCombine/InstCombineInternal.h
===================================================================
--- lib/Transforms/InstCombine/InstCombineInternal.h
+++ lib/Transforms/InstCombine/InstCombineInternal.h
@@ -724,11 +724,10 @@
 
     // 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77325.254578.patch
Type: text/x-patch
Size: 725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200402/8e7be816/attachment.bin>


More information about the llvm-commits mailing list