RegAllocGreedy: Improve live interval order in ReverseLocal mode
[oota-llvm.git] / lib / CodeGen / RegAllocGreedy.cpp
index e94f1bb0b6c73ad55b1c0816b955de7df6cef438..f30b6d803697ccfe46d3ffad084340d206aca417 100644 (file)
@@ -552,7 +552,7 @@ void RAGreedy::enqueue(PQueue &CurQueue, LiveInterval *LI) {
         // Allocating bottom up may allow many short LRGs to be assigned first
         // to one of the cheap registers. This could be much faster for very
         // large blocks on targets with many physical registers.
-        Prio = Indexes->getZeroIndex().getInstrDistance(LI->beginIndex());
+        Prio = Indexes->getZeroIndex().getInstrDistance(LI->endIndex());
       }
     }
     else {