[PATCH] D59565: Allow machine dce to remove uses in the same instruction

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 15:12:44 PDT 2019


rampitec marked an inline comment as done.
rampitec added inline comments.


================
Comment at: lib/CodeGen/DeadMachineInstructionElim.cpp:84-85
       } else {
-        if (!MRI->use_nodbg_empty(Reg))
-          // This def has a non-debug use. Don't delete the instruction!
-          return false;
+        for (const MachineOperand &MO : MRI->use_nodbg_operands(Reg)) {
+          if (MO.getParent() != MI)
+            // This def has a non-debug use. Don't delete the instruction!
----------------
rampitec wrote:
> arsenm wrote:
> > This needs a search limit in case of huge numbers of uses?
> > This can also use use_nodbg_instructions
> It does need a limit. The only way it can run into a very long loop if all huge amount of uses will belong to the same instruction. Otherwise it will immediately return false at the first use from any other place.
I mean it does not need a limit.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59565/new/

https://reviews.llvm.org/D59565





More information about the llvm-commits mailing list