diff options
Diffstat (limited to 'src/main/java/com/android/tools/r8/ir/regalloc')
-rw-r--r-- | src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java | 47 |
1 files changed, 30 insertions, 17 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 19392017c..631f8b2a9 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 @@ -289,11 +289,6 @@ public class LinearScanRegisterAllocator implements RegisterAllocator { Iterator<Instruction> instructionIterator = block.getInstructions().iterator(); while (instructionIterator.hasNext()) { Instruction instruction = instructionIterator.next(); - // Remove any local-read instructions now that live ranges are computed. - if (instruction.isDebugLocalRead()) { - instructionIterator.remove(); - continue; - } if (!instruction.isDebugPosition()) { continue; } @@ -1678,10 +1673,16 @@ public class LinearScanRegisterAllocator implements RegisterAllocator { live.add(use); } } - Value use = instruction.getPreviousLocalValue(); - if (use != null) { - assert use.needsRegister(); - live.add(use); + if (options.debug) { + for (Value use : instruction.getDebugValues()) { + assert use.needsRegister(); + live.add(use); + } + Value use = instruction.getPreviousLocalValue(); + if (use != null) { + assert use.needsRegister(); + live.add(use); + } } } for (Phi phi : block.getPhis()) { @@ -1798,15 +1799,27 @@ public class LinearScanRegisterAllocator implements RegisterAllocator { new LiveIntervalsUse(instruction.getNumber(), instruction.maxInValueRegister())); } } - Value use = instruction.getPreviousLocalValue(); - if (use != null) { - assert use.needsRegister(); - if (!live.contains(use)) { - live.add(use); - addLiveRange(use, block, instruction.getNumber()); + if (options.debug) { + int number = instruction.getNumber(); + for (Value use : instruction.getDebugValues()) { + assert use.needsRegister(); + if (!live.contains(use)) { + live.add(use); + addLiveRange(use, block, number); + } + LiveIntervals useIntervals = use.getLiveIntervals(); + useIntervals.addUse(new LiveIntervalsUse(number, Constants.U16BIT_MAX)); + } + Value use = instruction.getPreviousLocalValue(); + if (use != null) { + assert use.needsRegister(); + if (!live.contains(use)) { + live.add(use); + addLiveRange(use, block, number); + } + LiveIntervals useIntervals = use.getLiveIntervals(); + useIntervals.addUse(new LiveIntervalsUse(number, Constants.U16BIT_MAX)); } - LiveIntervals useIntervals = use.getLiveIntervals(); - useIntervals.addUse(new LiveIntervalsUse(instruction.getNumber(), Constants.U16BIT_MAX)); } } } |