[LIR] Compute the correct entry position for IR conversion
Bug: b/225838009
Bug: b/289474109
Change-Id: Ic1feff3193ecd7c17046d0feab884c1d7844eae9
diff --git a/src/main/java/com/android/tools/r8/lightir/Lir2IRConverter.java b/src/main/java/com/android/tools/r8/lightir/Lir2IRConverter.java
index 079b862..63a6db4 100644
--- a/src/main/java/com/android/tools/r8/lightir/Lir2IRConverter.java
+++ b/src/main/java/com/android/tools/r8/lightir/Lir2IRConverter.java
@@ -168,6 +168,7 @@
private BasicBlock currentBlock = null;
private int nextInstructionIndex = 0;
+ private final Position entryPosition;
private Position currentPosition;
private PositionEntry nextPositionEntry = null;
private int nextIndexInPositionsTable = 0;
@@ -226,6 +227,11 @@
.build()));
}
}
+ if (positionTable.length > 0 && positionTable[0].getFromInstructionIndex() == 0) {
+ entryPosition = positionTable[0].getPosition(originalMethod);
+ } else {
+ entryPosition = currentPosition;
+ }
}
@Override
@@ -360,7 +366,7 @@
return new IRCode(
appView.options(),
method,
- Position.syntheticNone(),
+ entryPosition,
blockList,
strategy.getValueNumberGenerator(),
basicBlockNumberGenerator,