summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-03-21 04:12:16 +0000
committerAndrew Trick <atrick@apple.com>2012-03-21 04:12:16 +0000
commit25baeca54d9c962c3cbb202ecb6e86252578a90e (patch)
treec90c153115f5380809fc9a09acd3897e182aae45 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
parentadb03b91eee4f349bef6f53efc71750cb00b64e2 (diff)
downloadbcm5719-llvm-25baeca54d9c962c3cbb202ecb6e86252578a90e.tar.gz
bcm5719-llvm-25baeca54d9c962c3cbb202ecb6e86252578a90e.zip
misched: fix LiveInterval update for bottom-up scheduling
llvm-svn: 153162
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 1019ad2594c..3ade66097cb 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -1049,9 +1049,19 @@ public:
bool hasRegMaskOp = false;
collectRanges(MI, Entering, Internal, Exiting, hasRegMaskOp, OldIdx);
- moveAllEnteringFrom(OldIdx, Entering);
- moveAllInternalFrom(OldIdx, Internal);
- moveAllExitingFrom(OldIdx, Exiting);
+ // To keep the LiveRanges valid within an interval, move the ranges closest
+ // to the destination first. This prevents ranges from overlapping, to that
+ // APIs like removeRange still work.
+ if (NewIdx < OldIdx) {
+ moveAllEnteringFrom(OldIdx, Entering);
+ moveAllInternalFrom(OldIdx, Internal);
+ moveAllExitingFrom(OldIdx, Exiting);
+ }
+ else {
+ moveAllExitingFrom(OldIdx, Exiting);
+ moveAllInternalFrom(OldIdx, Internal);
+ moveAllEnteringFrom(OldIdx, Entering);
+ }
if (hasRegMaskOp)
updateRegMaskSlots(OldIdx);
OpenPOWER on IntegriCloud