When creating intervals, leave min(1, numdefs) holes after each instruction.
authorEvan Cheng <evan.cheng@apple.com>
Sat, 18 Oct 2008 05:18:55 +0000 (05:18 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Sat, 18 Oct 2008 05:18:55 +0000 (05:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57765 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveIntervalAnalysis.cpp

index ff247ad4597f08d0107b87ca2183d656163f7c8f..1304659833db1d9ad150ded231faecae495353fb 100644 (file)
@@ -130,9 +130,13 @@ void LiveIntervals::computeNumbering() {
       MIIndex += InstrSlots::NUM;
       FunctionSize++;
       
-      // Insert an empty slot after every instruction.
-      MIIndex += InstrSlots::NUM;
-      i2miMap_.push_back(0);
+      // Insert min(1, numdefs) empty slots after every instruction.
+      unsigned Slots = I->getDesc().getNumDefs();
+      if (Slots == 0)
+        Slots = 1;
+      MIIndex += InstrSlots::NUM * Slots;
+      while (Slots--)
+        i2miMap_.push_back(0);
     }
     
     // Set the MBB2IdxMap entry for this MBB.
@@ -732,8 +736,12 @@ void LiveIntervals::computeIntervals() {
           handleRegisterDef(MBB, MI, MIIndex, MO, i);
         }
       }
-      
-      MIIndex += InstrSlots::NUM;
+
+      // Skip over the empty slots after each instruction.
+      unsigned Slots = MI->getDesc().getNumDefs();
+      if (Slots == 0)
+        Slots = 1;
+      MIIndex += InstrSlots::NUM * Slots;
       
       // Skip over empty indices.
       while (MIIndex / InstrSlots::NUM < i2miMap_.size() &&