Fix non-deterministic iteration of live intervals.
This particular one doesn't actually lead to non-determinism in
the output because the moves are sorted in the move scheduler
as well. However, we shouldn't use the ordering based only
on start position for live intervals.
R=sgjesse@google.com
Change-Id: Idbbaa7d87b7be9e7b2ff28147981a1524eeba730
diff --git a/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java b/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
index 1926f01..a8b3972 100644
--- a/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
+++ b/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
@@ -1756,8 +1756,7 @@
for (LiveIntervals intervals : liveIntervals) {
if (intervals.hasSplits()) {
LiveIntervals current = intervals;
- PriorityQueue<LiveIntervals> sortedChildren =
- new PriorityQueue<>((o1, o2) -> Integer.compare(o1.getStart(), o2.getStart()));
+ PriorityQueue<LiveIntervals> sortedChildren = new PriorityQueue<>();
sortedChildren.addAll(current.getSplitChildren());
for (LiveIntervals split = sortedChildren.poll();
split != null;