SCCP: No need to continue phi analysis when one operand is bottom

- This modification allows to remove the method visitPhi of
SparseConditionalConstantPropagation from hotspot when compiling
IncrementalDexingBenchmark and framework. When compiling
framework the number of iterations done into visitPhi is divided
by 11.

Bug: 74712202
Change-Id: I12aedf34121f2c1292f70e6af82ff80a1a74391e
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/constant/SparseConditionalConstantPropagation.java b/src/main/java/com/android/tools/r8/ir/analysis/constant/SparseConditionalConstantPropagation.java
index 3379864..6c9f075 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/constant/SparseConditionalConstantPropagation.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/constant/SparseConditionalConstantPropagation.java
@@ -129,16 +129,24 @@
     BasicBlock phiBlock = phi.getBlock();
     int phiBlockNumber = phiBlock.getNumber();
     LatticeElement element = Top.getInstance();
-    for (int i = 0; i < phiBlock.getPredecessors().size(); i++) {
-      BasicBlock predecessor = phiBlock.getPredecessors().get(i);
+    List<BasicBlock> predecessors = phiBlock.getPredecessors();
+    int size = predecessors.size();
+    for (int i = 0; i < size; i++) {
+      BasicBlock predecessor = predecessors.get(i);
       if (isExecutableEdge(predecessor.getNumber(), phiBlockNumber)) {
         element = element.meet(getLatticeElement(phi.getOperand(i)));
+        // bottom lattice can no longer be changed, thus no need to continue
+        if (element.isBottom()) {
+          break;
+        }
       }
     }
-    LatticeElement currentPhiElement = getLatticeElement(phi);
-    if (!element.isTop() && currentPhiElement.meet(element) != currentPhiElement) {
-      ssaEdges.add(phi);
-      setLatticeElement(phi, element);
+    if (!element.isTop()) {
+      LatticeElement currentPhiElement = getLatticeElement(phi);
+      if (currentPhiElement.meet(element) != currentPhiElement) {
+        ssaEdges.add(phi);
+        setLatticeElement(phi, element);
+      }
     }
   }