Minor fix after landing new argument propagation
Change-Id: I904d39af5bc4ecc4c134d081b40daf7bd79cbdcb
diff --git a/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescription.java b/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescription.java
index 448d440..1133b65 100644
--- a/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescription.java
+++ b/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescription.java
@@ -200,6 +200,12 @@
assert newType == rewrittenTypeInfo.oldType;
return new RewrittenTypeInfo(oldType, rewrittenTypeInfo.newType);
}
+
+ public boolean verifyIsDueToUnboxing(DexItemFactory dexItemFactory) {
+ assert oldType.toBaseType(dexItemFactory).isClassType();
+ assert newType.toBaseType(dexItemFactory).isIntType();
+ return true;
+ }
}
public static class ArgumentInfoCollection {
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 1ef6ffc..265d050 100644
--- a/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescriptionMethodOptimizationInfoFixer.java
+++ b/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescriptionMethodOptimizationInfoFixer.java
@@ -64,11 +64,13 @@
*/
@Override
public ClassInlinerMethodConstraint fixupClassInlinerMethodConstraint(
+ AppView<AppInfoWithLiveness> appView,
ClassInlinerMethodConstraint classInlinerMethodConstraint) {
if (getArgumentInfoCollection().isEmpty()) {
return classInlinerMethodConstraint;
}
- return classInlinerMethodConstraint.fixupAfterParametersChanged(getArgumentInfoCollection());
+ return classInlinerMethodConstraint.fixupAfterParametersChanged(
+ appView, getArgumentInfoCollection());
}
/**
@@ -157,10 +159,12 @@
*/
@Override
public SimpleInliningConstraint fixupSimpleInliningConstraint(
- SimpleInliningConstraint constraint, SimpleInliningConstraintFactory factory) {
+ AppView<AppInfoWithLiveness> appView,
+ SimpleInliningConstraint constraint,
+ SimpleInliningConstraintFactory factory) {
if (getArgumentInfoCollection().isEmpty()) {
return constraint;
}
- return constraint.fixupAfterParametersChanged(getArgumentInfoCollection(), factory);
+ return constraint.fixupAfterParametersChanged(appView, getArgumentInfoCollection(), factory);
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/inlining/AlwaysSimpleInliningConstraint.java b/src/main/java/com/android/tools/r8/ir/analysis/inlining/AlwaysSimpleInliningConstraint.java
index 9d4f3cf..9180568 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/inlining/AlwaysSimpleInliningConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/inlining/AlwaysSimpleInliningConstraint.java
@@ -4,8 +4,10 @@
package com.android.tools.r8.ir.analysis.inlining;
+import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.ir.code.InvokeMethod;
+import com.android.tools.r8.shaking.AppInfoWithLiveness;
/** Constraint that is always satisfied. */
public class AlwaysSimpleInliningConstraint extends SimpleInliningConstraint {
@@ -31,7 +33,9 @@
@Override
public SimpleInliningConstraint fixupAfterParametersChanged(
- ArgumentInfoCollection changes, SimpleInliningConstraintFactory factory) {
+ AppView<AppInfoWithLiveness> appView,
+ ArgumentInfoCollection changes,
+ SimpleInliningConstraintFactory factory) {
return this;
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/inlining/EqualToBooleanSimpleInliningConstraint.java b/src/main/java/com/android/tools/r8/ir/analysis/inlining/EqualToBooleanSimpleInliningConstraint.java
index eb663af..9a400ae 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/inlining/EqualToBooleanSimpleInliningConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/inlining/EqualToBooleanSimpleInliningConstraint.java
@@ -4,12 +4,14 @@
package com.android.tools.r8.ir.analysis.inlining;
+import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.RemovedArgumentInfo;
import com.android.tools.r8.ir.analysis.value.SingleValue;
import com.android.tools.r8.ir.code.Instruction;
import com.android.tools.r8.ir.code.InvokeMethod;
import com.android.tools.r8.ir.code.Value;
+import com.android.tools.r8.shaking.AppInfoWithLiveness;
/** Constraint that is satisfied if a specific argument is always true. */
public class EqualToBooleanSimpleInliningConstraint extends SimpleInliningArgumentConstraint {
@@ -29,7 +31,9 @@
@Override
public SimpleInliningConstraint fixupAfterParametersChanged(
- ArgumentInfoCollection changes, SimpleInliningConstraintFactory factory) {
+ AppView<AppInfoWithLiveness> appView,
+ ArgumentInfoCollection changes,
+ SimpleInliningConstraintFactory factory) {
if (changes.isArgumentRemoved(getArgumentIndex())) {
RemovedArgumentInfo removedArgumentInfo =
changes.getArgumentInfo(getArgumentIndex()).asRemovedArgumentInfo();
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/inlining/NeverSimpleInliningConstraint.java b/src/main/java/com/android/tools/r8/ir/analysis/inlining/NeverSimpleInliningConstraint.java
index 3d35fa9..d786e67 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/inlining/NeverSimpleInliningConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/inlining/NeverSimpleInliningConstraint.java
@@ -4,8 +4,10 @@
package com.android.tools.r8.ir.analysis.inlining;
+import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.ir.code.InvokeMethod;
+import com.android.tools.r8.shaking.AppInfoWithLiveness;
/** Constraint that is never satisfied. */
public class NeverSimpleInliningConstraint extends SimpleInliningConstraint {
@@ -30,7 +32,9 @@
@Override
public SimpleInliningConstraint fixupAfterParametersChanged(
- ArgumentInfoCollection changes, SimpleInliningConstraintFactory factory) {
+ AppView<AppInfoWithLiveness> appView,
+ ArgumentInfoCollection changes,
+ SimpleInliningConstraintFactory factory) {
return this;
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/inlining/NullSimpleInliningConstraint.java b/src/main/java/com/android/tools/r8/ir/analysis/inlining/NullSimpleInliningConstraint.java
index 750ca4d..bb4f505 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/inlining/NullSimpleInliningConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/inlining/NullSimpleInliningConstraint.java
@@ -4,6 +4,7 @@
package com.android.tools.r8.ir.analysis.inlining;
+import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfo;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.RemovedArgumentInfo;
@@ -13,6 +14,7 @@
import com.android.tools.r8.ir.code.Instruction;
import com.android.tools.r8.ir.code.InvokeMethod;
import com.android.tools.r8.ir.code.Value;
+import com.android.tools.r8.shaking.AppInfoWithLiveness;
/** Constraint that is satisfied if a specific argument is always null. */
public class NullSimpleInliningConstraint extends SimpleInliningArgumentConstraint {
@@ -33,7 +35,9 @@
@Override
public SimpleInliningConstraint fixupAfterParametersChanged(
- ArgumentInfoCollection changes, SimpleInliningConstraintFactory factory) {
+ AppView<AppInfoWithLiveness> appView,
+ ArgumentInfoCollection changes,
+ SimpleInliningConstraintFactory factory) {
ArgumentInfo argumentInfo = changes.getArgumentInfo(getArgumentIndex());
if (argumentInfo.isRemovedArgumentInfo()) {
RemovedArgumentInfo removedArgumentInfo =
@@ -49,8 +53,7 @@
} else if (argumentInfo.isRewrittenTypeInfo()) {
RewrittenTypeInfo rewrittenTypeInfo = argumentInfo.asRewrittenTypeInfo();
// We should only get here as a result of enum unboxing.
- assert rewrittenTypeInfo.getOldType().isClassType();
- assert rewrittenTypeInfo.getNewType().isIntType();
+ assert rewrittenTypeInfo.verifyIsDueToUnboxing(appView.dexItemFactory());
// Rewrite definitely-null constraints to definitely-zero constraints.
return nullability.isDefinitelyNull()
? factory.createEqualToNumberConstraint(getArgumentIndex(), 0)
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/inlining/NumberSimpleInliningConstraint.java b/src/main/java/com/android/tools/r8/ir/analysis/inlining/NumberSimpleInliningConstraint.java
index 50e9844..23b6233 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/inlining/NumberSimpleInliningConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/inlining/NumberSimpleInliningConstraint.java
@@ -4,12 +4,14 @@
package com.android.tools.r8.ir.analysis.inlining;
+import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.RemovedArgumentInfo;
import com.android.tools.r8.ir.analysis.value.SingleValue;
import com.android.tools.r8.ir.code.Instruction;
import com.android.tools.r8.ir.code.InvokeMethod;
import com.android.tools.r8.ir.code.Value;
+import com.android.tools.r8.shaking.AppInfoWithLiveness;
public abstract class NumberSimpleInliningConstraint extends SimpleInliningArgumentConstraint {
@@ -26,7 +28,9 @@
@Override
public SimpleInliningConstraint fixupAfterParametersChanged(
- ArgumentInfoCollection changes, SimpleInliningConstraintFactory factory) {
+ AppView<AppInfoWithLiveness> appView,
+ ArgumentInfoCollection changes,
+ SimpleInliningConstraintFactory factory) {
if (changes.isArgumentRemoved(getArgumentIndex())) {
RemovedArgumentInfo removedArgumentInfo =
changes.getArgumentInfo(getArgumentIndex()).asRemovedArgumentInfo();
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraint.java b/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraint.java
index b7d88f7..64e6f44 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraint.java
@@ -4,8 +4,10 @@
package com.android.tools.r8.ir.analysis.inlining;
+import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.ir.code.InvokeMethod;
+import com.android.tools.r8.shaking.AppInfoWithLiveness;
import com.google.common.collect.ImmutableList;
import java.util.function.Supplier;
@@ -91,5 +93,7 @@
}
public abstract SimpleInliningConstraint fixupAfterParametersChanged(
- ArgumentInfoCollection changes, SimpleInliningConstraintFactory factory);
+ AppView<AppInfoWithLiveness> appView,
+ ArgumentInfoCollection changes,
+ SimpleInliningConstraintFactory factory);
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraintConjunction.java b/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraintConjunction.java
index 3814e2e..55da1c0 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraintConjunction.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraintConjunction.java
@@ -4,8 +4,10 @@
package com.android.tools.r8.ir.analysis.inlining;
+import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.ir.code.InvokeMethod;
+import com.android.tools.r8.shaking.AppInfoWithLiveness;
import com.android.tools.r8.utils.ListUtils;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -68,13 +70,15 @@
@Override
public SimpleInliningConstraint fixupAfterParametersChanged(
- ArgumentInfoCollection changes, SimpleInliningConstraintFactory factory) {
+ AppView<AppInfoWithLiveness> appView,
+ ArgumentInfoCollection changes,
+ SimpleInliningConstraintFactory factory) {
List<SimpleInliningConstraint> rewrittenConstraints =
ListUtils.mapOrElse(
constraints,
constraint -> {
SimpleInliningConstraint rewrittenConstraint =
- constraint.fixupAfterParametersChanged(changes, factory);
+ constraint.fixupAfterParametersChanged(appView, changes, factory);
if (rewrittenConstraint.isAlways()) {
// Remove 'always' from conjunctions.
return null;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraintDisjunction.java b/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraintDisjunction.java
index de6bddb..0ac0ced 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraintDisjunction.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/inlining/SimpleInliningConstraintDisjunction.java
@@ -4,8 +4,10 @@
package com.android.tools.r8.ir.analysis.inlining;
+import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.ir.code.InvokeMethod;
+import com.android.tools.r8.shaking.AppInfoWithLiveness;
import com.android.tools.r8.utils.ListUtils;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -68,13 +70,15 @@
@Override
public SimpleInliningConstraint fixupAfterParametersChanged(
- ArgumentInfoCollection changes, SimpleInliningConstraintFactory factory) {
+ AppView<AppInfoWithLiveness> appView,
+ ArgumentInfoCollection changes,
+ SimpleInliningConstraintFactory factory) {
List<SimpleInliningConstraint> rewrittenConstraints =
ListUtils.mapOrElse(
constraints,
constraint -> {
SimpleInliningConstraint rewrittenConstraint =
- constraint.fixupAfterParametersChanged(changes, factory);
+ constraint.fixupAfterParametersChanged(appView, changes, factory);
if (rewrittenConstraint.isNever()) {
// Remove 'never' from disjunctions.
return null;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/AlwaysFalseClassInlinerMethodConstraint.java b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/AlwaysFalseClassInlinerMethodConstraint.java
index 0a2ffa1..0ceb39e 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/AlwaysFalseClassInlinerMethodConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/AlwaysFalseClassInlinerMethodConstraint.java
@@ -23,7 +23,8 @@
}
@Override
- public ClassInlinerMethodConstraint fixupAfterParametersChanged(ArgumentInfoCollection changes) {
+ public ClassInlinerMethodConstraint fixupAfterParametersChanged(
+ AppView<AppInfoWithLiveness> appView, ArgumentInfoCollection changes) {
return this;
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/AlwaysTrueClassInlinerMethodConstraint.java b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/AlwaysTrueClassInlinerMethodConstraint.java
index ebc8ad1..4b8a513 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/AlwaysTrueClassInlinerMethodConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/AlwaysTrueClassInlinerMethodConstraint.java
@@ -23,7 +23,8 @@
}
@Override
- public ClassInlinerMethodConstraint fixupAfterParametersChanged(ArgumentInfoCollection changes) {
+ public ClassInlinerMethodConstraint fixupAfterParametersChanged(
+ AppView<AppInfoWithLiveness> appView, ArgumentInfoCollection changes) {
return this;
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/ClassInlinerMethodConstraint.java b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/ClassInlinerMethodConstraint.java
index 3e2e706..ebe34b8 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/ClassInlinerMethodConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/ClassInlinerMethodConstraint.java
@@ -13,7 +13,8 @@
public interface ClassInlinerMethodConstraint {
- ClassInlinerMethodConstraint fixupAfterParametersChanged(ArgumentInfoCollection changes);
+ ClassInlinerMethodConstraint fixupAfterParametersChanged(
+ AppView<AppInfoWithLiveness> appView, ArgumentInfoCollection changes);
ParameterUsage getParameterUsage(int parameter);
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/ConditionalClassInlinerMethodConstraint.java b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/ConditionalClassInlinerMethodConstraint.java
index c559462..09a482d 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/ConditionalClassInlinerMethodConstraint.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/constraint/ConditionalClassInlinerMethodConstraint.java
@@ -35,7 +35,8 @@
}
@Override
- public ClassInlinerMethodConstraint fixupAfterParametersChanged(ArgumentInfoCollection changes) {
+ public ClassInlinerMethodConstraint fixupAfterParametersChanged(
+ AppView<AppInfoWithLiveness> appView, ArgumentInfoCollection changes) {
if (usages.isBottom()) {
return this;
}
@@ -54,8 +55,7 @@
// This is due to enum unboxing. After enum unboxing, we no longer need information
// about the usages of this parameter for class inlining.
RewrittenTypeInfo rewrittenTypeInfo = argumentInfo.asRewrittenTypeInfo();
- assert rewrittenTypeInfo.getOldType().isClassType();
- assert rewrittenTypeInfo.getNewType().isIntType();
+ assert rewrittenTypeInfo.verifyIsDueToUnboxing(appView.dexItemFactory());
return;
}
backing.put(changes.getNewArgumentIndex(argumentIndex), usagePerContext);
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/MethodOptimizationInfoFixer.java b/src/main/java/com/android/tools/r8/ir/optimize/info/MethodOptimizationInfoFixer.java
index 4b2476e..58c0f9b 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/MethodOptimizationInfoFixer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/MethodOptimizationInfoFixer.java
@@ -23,6 +23,7 @@
ConcreteCallSiteOptimizationInfo callSiteOptimizationInfo);
public abstract ClassInlinerMethodConstraint fixupClassInlinerMethodConstraint(
+ AppView<AppInfoWithLiveness> appView,
ClassInlinerMethodConstraint classInlinerMethodConstraint);
public abstract EnumUnboxerMethodClassification fixupEnumUnboxerMethodClassification(
@@ -39,5 +40,7 @@
public abstract int fixupReturnedArgumentIndex(int returnedArgumentIndex);
public abstract SimpleInliningConstraint fixupSimpleInliningConstraint(
- SimpleInliningConstraint constraint, SimpleInliningConstraintFactory factory);
+ AppView<AppInfoWithLiveness> appView,
+ SimpleInliningConstraint constraint,
+ SimpleInliningConstraintFactory factory);
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/MutableMethodOptimizationInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/MutableMethodOptimizationInfo.java
index c5f8fbe..c4a08f4 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/MutableMethodOptimizationInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/MutableMethodOptimizationInfo.java
@@ -13,7 +13,6 @@
import com.android.tools.r8.graph.PrunedItems;
import com.android.tools.r8.ir.analysis.inlining.NeverSimpleInliningConstraint;
import com.android.tools.r8.ir.analysis.inlining.SimpleInliningConstraint;
-import com.android.tools.r8.ir.analysis.inlining.SimpleInliningConstraintFactory;
import com.android.tools.r8.ir.analysis.type.ClassTypeElement;
import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.ir.analysis.value.AbstractValue;
@@ -160,13 +159,13 @@
public MutableMethodOptimizationInfo fixup(
AppView<AppInfoWithLiveness> appView, MethodOptimizationInfoFixer fixer) {
return fixupBridgeInfo(fixer)
- .fixupClassInlinerMethodConstraint(fixer)
+ .fixupClassInlinerMethodConstraint(appView, fixer)
.fixupEnumUnboxerMethodClassification(fixer)
.fixupInstanceInitializerInfo(appView, fixer)
.fixupNonNullParamOnNormalExits(fixer)
.fixupNonNullParamOrThrow(fixer)
.fixupReturnedArgumentIndex(fixer)
- .fixupSimpleInliningConstraint(fixer, appView.simpleInliningConstraintFactory());
+ .fixupSimpleInliningConstraint(appView, fixer);
}
public MutableMethodOptimizationInfo fixupClassTypeReferences(
@@ -254,8 +253,9 @@
}
public MutableMethodOptimizationInfo fixupClassInlinerMethodConstraint(
- MethodOptimizationInfoFixer fixer) {
- classInlinerConstraint = fixer.fixupClassInlinerMethodConstraint(classInlinerConstraint);
+ AppView<AppInfoWithLiveness> appView, MethodOptimizationInfoFixer fixer) {
+ classInlinerConstraint =
+ fixer.fixupClassInlinerMethodConstraint(appView, classInlinerConstraint);
return this;
}
@@ -473,9 +473,10 @@
}
public MutableMethodOptimizationInfo fixupSimpleInliningConstraint(
- MethodOptimizationInfoFixer fixer, SimpleInliningConstraintFactory factory) {
+ AppView<AppInfoWithLiveness> appView, MethodOptimizationInfoFixer fixer) {
simpleInliningConstraint =
- fixer.fixupSimpleInliningConstraint(simpleInliningConstraint, factory);
+ fixer.fixupSimpleInliningConstraint(
+ appView, simpleInliningConstraint, appView.simpleInliningConstraintFactory());
return this;
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/string/StringOptimizer.java b/src/main/java/com/android/tools/r8/ir/optimize/string/StringOptimizer.java
index 48f2199..1d0e301 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/string/StringOptimizer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/string/StringOptimizer.java
@@ -143,7 +143,10 @@
continue;
}
DexMethod invokedMethod = invoke.getInvokedMethod();
- if (invokedMethod.name == factory.substringName) {
+ if (invokedMethod.getHolderType() != factory.stringType) {
+ continue;
+ }
+ if (invokedMethod.getName() == factory.substringName) {
assert invoke.inValues().size() == 2 || invoke.inValues().size() == 3;
Value rcv = invoke.getReceiver().getAliasedValue();
if (rcv.definition == null