aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
diff options
context:
space:
mode:
authorMads Ager <ager@google.com>2017-05-23 14:31:04 +0200
committerMads Ager <ager@google.com>2017-05-23 14:31:04 +0200
commita66f4f1c961716543e6534a4d964ac654b759e41 (patch)
treec43419b361df4019264ef194b4217f4f2db3a086 /src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
parent1901889bf5876e7dead7baf26b709b18e819a3f1 (diff)
downloadr8-a66f4f1c961716543e6534a4d964ac654b759e41.tar.gz
Fix isRematerializable to always use the unadjusted real register number.
This ensures that isRematerializable returns the same value for the same interval both when generating moves and when performing peephole optimizations. Change-Id: I2953fac1db981e045c61b7c9717098c2479862a6
Diffstat (limited to 'src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java')
-rw-r--r--src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java7
1 files changed, 6 insertions, 1 deletions
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 e79abc1fb..f2d039d5b 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
@@ -470,7 +470,7 @@ public class LinearScanRegisterAllocator implements RegisterAllocator {
return realRegisterNumberFromAllocated(intervalsRegister);
}
- int realRegisterNumberFromAllocated(int allocated) {
+ int unadjustedRealRegisterFromAllocated(int allocated) {
assert allocated != NO_REGISTER;
assert allocated >= 0;
int register;
@@ -484,6 +484,11 @@ public class LinearScanRegisterAllocator implements RegisterAllocator {
// For everything else use the lower numbers.
register = allocated - numberOfArgumentRegisters - NUMBER_OF_SENTINEL_REGISTERS;
}
+ return register;
+ }
+
+ int realRegisterNumberFromAllocated(int allocated) {
+ int register = unadjustedRealRegisterFromAllocated(allocated);
// Adjust for spill registers that turn out to be unused because the value can be
// rematerialized instead of spilled.
if (unusedRegisters != null) {