Minor updates to argument propagator
Change-Id: I19d896b94816c46021e5ec49f54caa008ee181e5
diff --git a/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescriptionMethodOptimizationInfoFixer.java b/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescriptionMethodOptimizationInfoFixer.java
index 4c869ef..e25d391 100644
--- a/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescriptionMethodOptimizationInfoFixer.java
+++ b/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescriptionMethodOptimizationInfoFixer.java
@@ -162,7 +162,7 @@
return bitSet;
}
int n = bitSet.length();
- BitSet rewrittenNonNullParamOnNormalExits = new BitSet(n);
+ BitSet rewrittenBitSet = new BitSet(n);
for (int argumentIndex = 0; argumentIndex < n; argumentIndex++) {
if (!bitSet.get(argumentIndex)) {
continue;
@@ -171,9 +171,8 @@
if (argumentInfo.isRemovedArgumentInfo() || argumentInfo.isRewrittenTypeInfo()) {
continue;
}
- rewrittenNonNullParamOnNormalExits.set(
- getArgumentInfoCollection().getNewArgumentIndex(argumentIndex));
+ rewrittenBitSet.set(getArgumentInfoCollection().getNewArgumentIndex(argumentIndex));
}
- return rewrittenNonNullParamOnNormalExits.isEmpty() ? null : rewrittenNonNullParamOnNormalExits;
+ return rewrittenBitSet.isEmpty() ? null : rewrittenBitSet;
}
}
diff --git a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorOptimizationInfoPopulator.java b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorOptimizationInfoPopulator.java
index 9b5a3fa..4ec1be1 100644
--- a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorOptimizationInfoPopulator.java
+++ b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorOptimizationInfoPopulator.java
@@ -296,12 +296,16 @@
private ParameterState getUnusedParameterState(DexType argumentType) {
if (argumentType.isArrayType()) {
+ // Ensure argument removal by simulating that this unused parameter is the constant null.
return new ConcreteArrayTypeParameterState(Nullability.definitelyNull());
} else if (argumentType.isClassType()) {
+ // Ensure argument removal by simulating that this unused parameter is the constant null.
return new ConcreteClassTypeParameterState(
appView.abstractValueFactory().createNullValue(), DynamicType.definitelyNull());
} else {
assert argumentType.isPrimitiveType();
+ // Ensure argument removal by simulating that this unused parameter is the constant zero.
+ // Note that the same zero value is used for all primitive types.
return new ConcretePrimitiveTypeParameterState(
appView.abstractValueFactory().createZeroValue());
}