[llvm-commits] [llvm] r159013 - /llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Jun 22 10:31:01 PDT 2012


Author: stoklund
Date: Fri Jun 22 12:31:01 2012
New Revision: 159013

URL: http://llvm.org/viewvc/llvm-project?rev=159013&view=rev
Log:
Use MRI::isConstantPhysReg() to check remat feasibility.

Don't depend on LiveIntervals::hasInterval() to determine if a physreg
is reserved and constant.

Modified:
    llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp

Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp?rev=159013&r1=159012&r2=159013&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp Fri Jun 22 12:31:01 2012
@@ -82,12 +82,16 @@
   UseIdx = UseIdx.getRegSlot(true);
   for (unsigned i = 0, e = OrigMI->getNumOperands(); i != e; ++i) {
     const MachineOperand &MO = OrigMI->getOperand(i);
-    if (!MO.isReg() || !MO.getReg() || MO.isDef())
-      continue;
-    // Reserved registers are OK.
-    if (MO.isUndef() || !LIS.hasInterval(MO.getReg()))
+    if (!MO.isReg() || !MO.getReg() || !MO.readsReg())
       continue;
 
+    // We can't remat physreg uses, unless it is a constant.
+    if (TargetRegisterInfo::isPhysicalRegister(MO.getReg())) {
+      if (MRI.isConstantPhysReg(MO.getReg(), VRM->getMachineFunction()))
+        continue;
+      return false;
+    }
+
     LiveInterval &li = LIS.getInterval(MO.getReg());
     const VNInfo *OVNI = li.getVNInfoAt(OrigIdx);
     if (!OVNI)





More information about the llvm-commits mailing list