[llvm-commits] [llvm] r159006 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocPBQP.cpp lib/CodeGen/RegisterCoalescer.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Jun 22 09:46:45 PDT 2012


Author: stoklund
Date: Fri Jun 22 11:46:44 2012
New Revision: 159006

URL: http://llvm.org/viewvc/llvm-project?rev=159006&view=rev
Log:
Remove LiveIntervals::trackingRegUnits().

With regunit liveness permanently enabled, this function would always
return true.

Also remove now obsolete code for checking physreg interference.

Modified:
    llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
    llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
    llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
    llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp

Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=159006&r1=159005&r2=159006&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Fri Jun 22 11:46:44 2012
@@ -347,11 +347,6 @@
       return RegUnitIntervals[Unit];
     }
 
-    /// trackingRegUnits - Does LiveIntervals curently track register units?
-    /// This function will be removed when regunit tracking is permanently
-    /// enabled.
-    bool trackingRegUnits() const { return !RegUnitIntervals.empty(); }
-
   private:
     /// computeIntervals - Compute live intervals.
     void computeIntervals();

Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=159006&r1=159005&r2=159006&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Jun 22 11:46:44 2012
@@ -1188,7 +1188,7 @@
 
       // Collect ranges for register units. These live ranges are computed on
       // demand, so just skip any that haven't been computed yet.
-      if (TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.trackingRegUnits())
+      if (TargetRegisterInfo::isPhysicalRegister(Reg))
         for (MCRegUnitIterator Units(Reg, &TRI); Units.isValid(); ++Units)
           if (LiveInterval *LI = LIS.getCachedRegUnit(*Units))
             collectRanges(MO, LI, Entering, Internal, Exiting, OldIdx);

Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=159006&r1=159005&r2=159006&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Fri Jun 22 11:46:44 2012
@@ -236,64 +236,20 @@
         continue;
 
       // vregLI overlaps fixed regunit interference.
-      if (LIS->trackingRegUnits()) {
-        bool Interference = false;
-        for (MCRegUnitIterator Units(preg, tri); Units.isValid(); ++Units) {
-          if (vregLI->overlaps(LIS->getRegUnit(*Units))) {
-            Interference = true;
-            break;
-          }
+      bool Interference = false;
+      for (MCRegUnitIterator Units(preg, tri); Units.isValid(); ++Units) {
+        if (vregLI->overlaps(LIS->getRegUnit(*Units))) {
+          Interference = true;
+          break;
         }
-        if (Interference)
-          continue;
       }
+      if (Interference)
+        continue;
 
       // preg is usable for this virtual register.
       vrAllowed.push_back(preg);
     }
 
-    RegSet overlappingPRegs;
-
-    // Record physical registers whose ranges overlap.
-    for (RegSet::const_iterator pregItr = pregs.begin(),
-                                pregEnd = pregs.end();
-         pregItr != pregEnd; ++pregItr) {
-      unsigned preg = *pregItr;
-      if (!LIS->hasInterval(preg))
-        continue;
-      const LiveInterval *pregLI = &LIS->getInterval(preg);
-
-      if (pregLI->empty()) {
-        continue;
-      }
-
-      if (vregLI->overlaps(*pregLI))
-        overlappingPRegs.insert(preg);      
-    }
-
-    for (RegSet::const_iterator pregItr = overlappingPRegs.begin(),
-                                pregEnd = overlappingPRegs.end();
-         pregItr != pregEnd; ++pregItr) {
-      unsigned preg = *pregItr;
-
-      // Remove the register from the allowed set.
-      VRAllowed::iterator eraseItr =
-        std::find(vrAllowed.begin(), vrAllowed.end(), preg);
-
-      if (eraseItr != vrAllowed.end()) {
-        vrAllowed.erase(eraseItr);
-      }
-
-      // Also remove any aliases.
-      for (MCRegAliasIterator AI(preg, tri, false); AI.isValid(); ++AI) {
-        VRAllowed::iterator eraseItr =
-          std::find(vrAllowed.begin(), vrAllowed.end(), *AI);
-        if (eraseItr != vrAllowed.end()) {
-          vrAllowed.erase(eraseItr);
-        }
-      }
-    }
-
     // Construct the node.
     PBQP::Graph::NodeItr node =
       g.addNode(PBQP::Vector(vrAllowed.size() + 1, 0));

Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp?rev=159006&r1=159005&r2=159006&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp Fri Jun 22 11:46:44 2012
@@ -1100,26 +1100,12 @@
 
   // Deny any overlapping intervals.  This depends on all the reserved
   // register live ranges to look like dead defs.
-  if (LIS->trackingRegUnits()) {
-    for (MCRegUnitIterator UI(CP.getDstReg(), TRI); UI.isValid(); ++UI)
-      if (RHS.overlaps(LIS->getRegUnit(*UI))) {
-        DEBUG(dbgs() << "\t\tInterference: " << PrintRegUnit(*UI, TRI) << '\n');
-        return false;
-      }
-  } else {
-    for (MCRegAliasIterator AS(CP.getDstReg(), TRI, true); AS.isValid(); ++AS) {
-      if (!LIS->hasInterval(*AS)) {
-        // Make sure at least DstReg itself exists before attempting a join.
-        if (*AS == CP.getDstReg())
-          LIS->getOrCreateInterval(CP.getDstReg());
-        continue;
-      }
-      if (RHS.overlaps(LIS->getInterval(*AS))) {
-        DEBUG(dbgs() << "\t\tInterference: " << PrintReg(*AS, TRI) << '\n');
-        return false;
-      }
+  for (MCRegUnitIterator UI(CP.getDstReg(), TRI); UI.isValid(); ++UI)
+    if (RHS.overlaps(LIS->getRegUnit(*UI))) {
+      DEBUG(dbgs() << "\t\tInterference: " << PrintRegUnit(*UI, TRI) << '\n');
+      return false;
     }
-  }
+
   // Skip any value computations, we are not adding new values to the
   // reserved register.  Also skip merging the live ranges, the reserved
   // register live range doesn't need to be accurate as long as all the





More information about the llvm-commits mailing list