Version 2.1.85
This version fixes a problem in the conflict resolution from cherry-picking 14522eddb6c5f8812efed66840ddce3b098f9e60 in 2.1.84.
Bug: 174167294
Change-Id: Ibb433f86284b2ef284eaab74edfcd506f5b4f314
diff --git a/src/main/java/com/android/tools/r8/Version.java b/src/main/java/com/android/tools/r8/Version.java
index 01a397b..02b8026 100644
--- a/src/main/java/com/android/tools/r8/Version.java
+++ b/src/main/java/com/android/tools/r8/Version.java
@@ -11,7 +11,7 @@
// This field is accessed from release scripts using simple pattern matching.
// Therefore, changing this field could break our release scripts.
- public static final String LABEL = "2.1.84";
+ public static final String LABEL = "2.1.85";
private Version() {
}
diff --git a/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionListIterator.java b/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionListIterator.java
index b4ceb0d..e7b3924 100644
--- a/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionListIterator.java
+++ b/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionListIterator.java
@@ -331,7 +331,8 @@
}
@Override
- public BasicBlock split(IRCode code, ListIterator<BasicBlock> blocksIterator) {
+ public BasicBlock split(
+ IRCode code, ListIterator<BasicBlock> blocksIterator, boolean keepCatchHandlers) {
List<BasicBlock> blocks = code.blocks;
assert blocksIterator == null || IteratorUtils.peekPrevious(blocksIterator) == block;
@@ -346,7 +347,6 @@
// Prepare the new block, placing the exception handlers on the block with the throwing
// instruction.
- boolean keepCatchHandlers = hasPrevious() && peekPrevious().instructionTypeCanThrow();
newBlock = block.createSplitBlock(blockNumber, keepCatchHandlers);
// Add a goto instruction.
diff --git a/src/main/java/com/android/tools/r8/ir/code/IRCodeInstructionListIterator.java b/src/main/java/com/android/tools/r8/ir/code/IRCodeInstructionListIterator.java
index b4860aa..47ce330 100644
--- a/src/main/java/com/android/tools/r8/ir/code/IRCodeInstructionListIterator.java
+++ b/src/main/java/com/android/tools/r8/ir/code/IRCodeInstructionListIterator.java
@@ -68,7 +68,8 @@
}
@Override
- public BasicBlock split(IRCode code, ListIterator<BasicBlock> blockIterator) {
+ public BasicBlock split(
+ IRCode code, ListIterator<BasicBlock> blockIterator, boolean keepCatchHandlers) {
throw new Unimplemented();
}
diff --git a/src/main/java/com/android/tools/r8/ir/code/InstructionListIterator.java b/src/main/java/com/android/tools/r8/ir/code/InstructionListIterator.java
index a546ee3..b15b08c 100644
--- a/src/main/java/com/android/tools/r8/ir/code/InstructionListIterator.java
+++ b/src/main/java/com/android/tools/r8/ir/code/InstructionListIterator.java
@@ -104,20 +104,25 @@
/**
* Split the block into two blocks at the point of the {@link ListIterator} cursor. The existing
- * block will have all the instructions before the cursor, and the new block all the
- * instructions after the cursor.
+ * block will have all the instructions before the cursor, and the new block all the instructions
+ * after the cursor.
*
- * If the current block has catch handlers these catch handlers will be attached to the block
+ * <p>If the current block has catch handlers these catch handlers will be attached to the block
* containing the throwing instruction after the split.
*
* @param code the IR code for the block this iterator originates from.
* @param blockIterator basic block iterator used to iterate the blocks. This must be positioned
- * just after the block for which this is the instruction iterator. After this method returns it
- * will be positioned just after the basic block returned. Calling {@link #remove} without
- * further navigation will remove that block.
+ * just after the block for which this is the instruction iterator. After this method returns
+ * it will be positioned just after the basic block returned. Calling {@link #remove} without
+ * further navigation will remove that block.
+ * @param keepCatchHandlers
* @return Returns the new block with the instructions after the cursor.
*/
- BasicBlock split(IRCode code, ListIterator<BasicBlock> blockIterator);
+ BasicBlock split(IRCode code, ListIterator<BasicBlock> blockIterator, boolean keepCatchHandlers);
+
+ default BasicBlock split(IRCode code, ListIterator<BasicBlock> blockIterator) {
+ return split(code, blockIterator, hasPrevious() && peekPrevious().instructionTypeCanThrow());
+ }
default BasicBlock split(IRCode code) {
return split(code, null);
diff --git a/src/main/java/com/android/tools/r8/ir/code/LinearFlowInstructionListIterator.java b/src/main/java/com/android/tools/r8/ir/code/LinearFlowInstructionListIterator.java
index d73f8df..5b230bc 100644
--- a/src/main/java/com/android/tools/r8/ir/code/LinearFlowInstructionListIterator.java
+++ b/src/main/java/com/android/tools/r8/ir/code/LinearFlowInstructionListIterator.java
@@ -77,7 +77,8 @@
}
@Override
- public BasicBlock split(IRCode code, ListIterator<BasicBlock> blockIterator) {
+ public BasicBlock split(
+ IRCode code, ListIterator<BasicBlock> blockIterator, boolean keepCatchHandlers) {
return currentBlockIterator.split(code, blockIterator);
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/MemberValuePropagation.java b/src/main/java/com/android/tools/r8/ir/optimize/MemberValuePropagation.java
index 3e1f768..4bd9f0d 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/MemberValuePropagation.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/MemberValuePropagation.java
@@ -312,11 +312,11 @@
// Insert the definition of the replacement.
replacement.setPosition(position);
if (block.hasCatchHandlers()) {
- BasicBlock splitBlock = iterator.split(code, blocks);
+ BasicBlock splitBlock = iterator.split(code, blocks, false);
splitBlock.listIterator(code).add(replacement);
- assert block.hasCatchHandlers();
- assert !splitBlock.hasCatchHandlers();
- splitBlock.copyCatchHandlers(code, blocks, block, appView.options());
+ assert !block.hasCatchHandlers();
+ assert splitBlock.hasCatchHandlers();
+ block.copyCatchHandlers(code, blocks, splitBlock, appView.options());
} else {
iterator.add(replacement);
}
@@ -416,11 +416,11 @@
// Insert the definition of the replacement.
replacement.setPosition(position);
if (block.hasCatchHandlers()) {
- BasicBlock splitBlock = iterator.split(code, blocks);
+ BasicBlock splitBlock = iterator.split(code, blocks, false);
splitBlock.listIterator(code).add(replacement);
- assert block.hasCatchHandlers();
- assert !splitBlock.hasCatchHandlers();
- splitBlock.copyCatchHandlers(code, blocks, block, appView.options());
+ assert !block.hasCatchHandlers();
+ assert splitBlock.hasCatchHandlers();
+ block.copyCatchHandlers(code, blocks, splitBlock, appView.options());
} else {
iterator.add(replacement);
}
diff --git a/src/test/java/com/android/tools/r8/ir/regalloc/RegisterMoveSchedulerTest.java b/src/test/java/com/android/tools/r8/ir/regalloc/RegisterMoveSchedulerTest.java
index 8ea5334..b4d2c3a 100644
--- a/src/test/java/com/android/tools/r8/ir/regalloc/RegisterMoveSchedulerTest.java
+++ b/src/test/java/com/android/tools/r8/ir/regalloc/RegisterMoveSchedulerTest.java
@@ -132,7 +132,8 @@
}
@Override
- public BasicBlock split(IRCode code, ListIterator<BasicBlock> blockIterator) {
+ public BasicBlock split(
+ IRCode code, ListIterator<BasicBlock> blockIterator, boolean keepCatchHandlers) {
throw new Unimplemented();
}