misched: fix LI update for bottom-up.
authorAndrew Trick <atrick@apple.com>
Wed, 21 Mar 2012 04:12:01 +0000 (04:12 +0000)
committerAndrew Trick <atrick@apple.com>
Wed, 21 Mar 2012 04:12:01 +0000 (04:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153158 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveIntervalAnalysis.cpp

index 70ed1c398bafa050ec279b73789fd09bdaf6b53f..1019ad2594cb0be6b73d5fd635a05742b90b360a 100644 (file)
@@ -1319,8 +1319,14 @@ private:
   void moveEnteringDownFrom(SlotIndex OldIdx, IntRangePair& P) {
     LiveInterval* LI = P.first;
     LiveRange* LR = P.second;
+    // Extend the LiveRange if NewIdx is past the end.
     if (NewIdx > LR->end) {
-      moveKillFlags(LI->reg, LR->end, NewIdx);
+      // Move kill flags if OldIdx was not originally the end
+      // (otherwise LR->end points to an invalid slot).
+      if (LR->end.getRegSlot() != OldIdx.getRegSlot()) {
+        assert(LR->end > OldIdx && "LiveRange does not cover original slot");
+        moveKillFlags(LI->reg, LR->end, NewIdx);
+      }
       LR->end = NewIdx.getRegSlot();
     }
   }