Remove assert that identifies unlikely but possible case
Bug: b/331587404
Change-Id: Ic15d3389cd67c836a1a43294bdf0b24b4f824e1b
diff --git a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorCodeScanner.java b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorCodeScanner.java
index 8df07a0..e8287d3 100644
--- a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorCodeScanner.java
+++ b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorCodeScanner.java
@@ -538,12 +538,16 @@
ProgramMethod context,
ConcretePolymorphicMethodStateOrBottom existingMethodState) {
DynamicTypeWithUpperBound dynamicReceiverType = invoke.getReceiver().getDynamicType(appView);
+ // TODO(b/331587404): Investigate if we can replace the receiver by null before entering this
+ // pass, so that this special case is not needed.
if (dynamicReceiverType.isNullType()) {
// This can happen if we were unable to determine that the receiver is a phi value where null
- // information has not been propagated down. See if we can improve the test here or ensure
- // that all phi's are normalized before computing the optimization info.
- assert appView.checkForTesting(() -> false) : "b/250634405";
- return MethodState.unknown();
+ // information has not been propagated down. Ideally this case would never happen as it should
+ // be possible to replace the receiver by the null constant in this case.
+ //
+ // Since the receiver is known to be null, no argument information should be propagated to the
+ // callees, so we return bottom here.
+ return MethodState.bottom();
}
ProgramMethod singleTarget = invoke.lookupSingleProgramTarget(appView, context);
diff --git a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/codescanner/MethodStateCollection.java b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/codescanner/MethodStateCollection.java
index 856ff9d..758bd34 100644
--- a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/codescanner/MethodStateCollection.java
+++ b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/codescanner/MethodStateCollection.java
@@ -68,8 +68,7 @@
(ignore, existingMethodState) -> {
if (existingMethodState == null) {
MethodState newMethodState = methodStateSupplier.apply(MethodState.bottom());
- assert !newMethodState.isBottom();
- return newMethodState;
+ return newMethodState.isBottom() ? null : newMethodState;
}
assert !existingMethodState.isBottom();
timing.begin("Join temporary method state");