Revert "Update null cyclic phis when rewriting always throwing instructions"
This reverts commit a0b5226d8b06317f51e6f94752b40dbe2b7ee328.
Reason for revert: Dynamic types are not static types
Change-Id: Ic13cdca444e7f8c9b68ac7888532f6fd1ecceaca
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/type/DestructivePhiTypeUpdater.java b/src/main/java/com/android/tools/r8/ir/analysis/type/DestructivePhiTypeUpdater.java
index 1e624e9..617e995 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/type/DestructivePhiTypeUpdater.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/type/DestructivePhiTypeUpdater.java
@@ -60,7 +60,7 @@
worklist.addAll(affectedPhis);
while (!worklist.isEmpty()) {
Phi phi = worklist.poll();
- TypeElement newType = phi.getDynamicUpperBoundType(appView);
+ TypeElement newType = phi.computePhiType(appView);
if (!phi.getType().equals(newType)) {
assert !newType.isBottom();
phi.setType(newType);
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/passes/ThrowCatchOptimizer.java b/src/main/java/com/android/tools/r8/ir/conversion/passes/ThrowCatchOptimizer.java
index fc64a45..9ef5a8b 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/passes/ThrowCatchOptimizer.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/passes/ThrowCatchOptimizer.java
@@ -6,12 +6,10 @@
import com.android.tools.r8.errors.Unreachable;
import com.android.tools.r8.graph.AppInfo;
-import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexClassAndMethod;
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.ir.code.BasicBlock;
import com.android.tools.r8.ir.code.CatchHandlers;
import com.android.tools.r8.ir.code.CatchHandlers.CatchHandler;
@@ -219,28 +217,6 @@
ProgramMethod context = code.context();
boolean hasUnlinkedCatchHandlers = false;
boolean hasChanged = false;
- // For cyclic phis we sometimes do not propagate the dynamic upper type after rewritings.
- // The inValue.isAlwaysNull(appView) check below will not recompute the dynamic type of phi's
- // so we recompute all phis here if they are always null.
- AppView<AppInfoWithClassHierarchy> appViewWithClassHierarchy =
- appView.hasClassHierarchy() ? appView.withClassHierarchy() : null;
- if (appViewWithClassHierarchy != null) {
- code.blocks.forEach(
- block ->
- block
- .getPhis()
- .forEach(
- phi -> {
- if (!phi.getType().isDefinitelyNull()) {
- TypeElement dynamicUpperBoundType =
- phi.getDynamicUpperBoundType(appViewWithClassHierarchy);
- if (dynamicUpperBoundType.isDefinitelyNull()) {
- affectedValues.add(phi);
- phi.setType(dynamicUpperBoundType);
- }
- }
- }));
- }
while (blockIterator.hasNext()) {
BasicBlock block = blockIterator.next();
if (block.getNumber() != 0 && block.getPredecessors().isEmpty()) {