[llvm-commits] [llvm] r124815 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Feb 3 12:29:44 PST 2011


Author: stoklund
Date: Thu Feb  3 14:29:43 2011
New Revision: 124815

URL: http://llvm.org/viewvc/llvm-project?rev=124815&view=rev
Log:
Ensure that the computed interference intervals actually overlap their basic blocks.

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

Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124815&r1=124814&r2=124815&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Feb  3 14:29:43 2011
@@ -626,6 +626,8 @@
         IntI.advanceTo(Start);
         if (!IntI.valid())
           break;
+        if (IntI.start() >= Stop)
+          continue;
         if (!IP.first.isValid() || IntI.start() < IP.first)
           IP.first = IntI.start();
       }
@@ -635,6 +637,8 @@
         IntI.advanceTo(Stop);
         if (!IntI.valid() || IntI.start() >= Stop)
           --IntI;
+        if (IntI.stop() <= Start)
+          continue;
         if (!IP.second.isValid() || IntI.stop() > IP.second)
           IP.second = IntI.stop();
       }
@@ -663,10 +667,15 @@
     tie(Start, Stop) = Indexes->getMBBRange(BI.MBB);
 
     DEBUG(dbgs() << "BB#" << BI.MBB->getNumber() << " -> EB#"
-                 << Bundles->getBundle(BI.MBB->getNumber(), 1));
+                 << Bundles->getBundle(BI.MBB->getNumber(), 1)
+                 << " intf [" << IP.first << ';' << IP.second << ')');
+
+    // The interference interval should either be invalid or overlap MBB.
+    assert((!IP.first.isValid() || IP.first < Stop) && "Bad interference");
+    assert((!IP.second.isValid() || IP.second > Start) && "Bad interference");
 
     // Check interference leaving the block.
-    if (!IP.second.isValid() || IP.second < Start) {
+    if (!IP.second.isValid()) {
       // Block is interference-free.
       DEBUG(dbgs() << ", no interference");
       if (!BI.Uses) {
@@ -739,7 +748,7 @@
                  << " -> BB#" << BI.MBB->getNumber());
 
     // Check interference entering the block.
-    if (!IP.first.isValid() || IP.first > Stop) {
+    if (!IP.first.isValid()) {
       // Block is interference-free.
       DEBUG(dbgs() << ", no interference");
       if (!BI.Uses) {





More information about the llvm-commits mailing list