[PATCH] D109077: Do not attempt rematerialization with a killed register use

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 1 11:02:00 PDT 2021


rampitec created this revision.
rampitec added reviewers: qcolombet, kparzysz, dmgreen.
Herald added a subscriber: hiraditya.
rampitec requested review of this revision.
Herald added a project: LLVM.

This change shall be NFC since the value of the used register
will not be available anyway if it is killed, but there is no
point to even attempt rematerialization. We could skip a lot
of logic in the RA by bailing out early.


https://reviews.llvm.org/D109077

Files:
  llvm/lib/CodeGen/TargetInstrInfo.cpp


Index: llvm/lib/CodeGen/TargetInstrInfo.cpp
===================================================================
--- llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -984,6 +984,11 @@
     // same virtual register, though.
     if (MO.isDef() && Reg != DefReg)
       return false;
+
+    // Do not bother to try rematerializing an instruction with a killed use,
+    // the value of the operand will not be available anyway.
+    if (MO.isKill())
+      return false;
   }
 
   // Everything checked out.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109077.369994.patch
Type: text/x-patch
Size: 537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210901/f955bde6/attachment-0001.bin>


More information about the llvm-commits mailing list