[llvm-commits] [llvm] r150816 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Feb 17 08:40:44 PST 2012


Author: stoklund
Date: Fri Feb 17 10:40:44 2012
New Revision: 150816

URL: http://llvm.org/viewvc/llvm-project?rev=150816&view=rev
Log:
Revert r150288, "Allow Post-RA LICM to hoist reserved register reads."

This caused miscompilations on out-of-tree targets, and possibly i386 as
well.

I'll find some other way of hoisting %rip-relative loads from loops
containing calls.

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

Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=150816&r1=150815&r2=150816&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Fri Feb 17 10:40:44 2012
@@ -68,7 +68,6 @@
     MachineRegisterInfo *MRI;
     const InstrItineraryData *InstrItins;
     bool PreRegAlloc;
-    BitVector ReservedRegs;
 
     // Various analyses that we use...
     AliasAnalysis        *AA;      // Alias analysis info.
@@ -338,8 +337,6 @@
     for (TargetRegisterInfo::regclass_iterator I = TRI->regclass_begin(),
            E = TRI->regclass_end(); I != E; ++I)
       RegLimit[(*I)->getID()] = TRI->getRegPressureLimit(*I, MF);
-  } else {
-    ReservedRegs = TRI->getReservedRegs(MF);
   }
 
   // Get our Loop information...
@@ -429,9 +426,6 @@
            "Not expecting virtual register!");
 
     if (!MO.isDef()) {
-      // Allow reserved register reads to be hoisted.
-      if (ReservedRegs.test(Reg))
-        continue;
       if (Reg && (PhysRegDefs.test(Reg) || PhysRegClobbers.test(Reg)))
         // If it's using a non-loop-invariant register, then it's obviously not
         // safe to hoist.
@@ -537,11 +531,6 @@
         const MachineOperand &MO = MI->getOperand(j);
         if (!MO.isReg() || MO.isDef() || !MO.getReg())
           continue;
-        // Allow hoisting of reserved register reads that aren't call preserved.
-        // For example %rip.
-        // IsLoopInvariantInst() already checks MRI->isConstantPhysReg().
-        if (ReservedRegs.test(MO.getReg()))
-          continue;
         if (PhysRegDefs.test(MO.getReg()) ||
             PhysRegClobbers.test(MO.getReg())) {
           // If it's using a non-loop-invariant register, then it's obviously





More information about the llvm-commits mailing list