Revert "Keep singler caller inlinees after inlining if reprocessing"

This reverts commit 5f69e7b6dccf24ebd760f75784d1784c2e36ecfa.

Reason for revert: Inconsistent overloads

Change-Id: Ic050083efa1e4f7fb7f746883c9c0204994a26e3
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/CallSiteInformation.java b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/CallSiteInformation.java
index 234eeee..c2e13af 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/CallSiteInformation.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/CallSiteInformation.java
@@ -13,8 +13,6 @@
 import com.android.tools.r8.utils.classhierarchy.MethodOverridesCollector;
 import com.android.tools.r8.utils.collections.ProgramMethodSet;
 import com.google.common.collect.Sets;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Set;
 
 public abstract class CallSiteInformation {
@@ -25,14 +23,6 @@
    * <p>For pinned methods (methods kept through Proguard keep rules) this will always answer <code>
    * false</code>.
    */
-  public abstract boolean hasSingleCallSite(ProgramMethod context, ProgramMethod method);
-
-  /**
-   * Checks if the given method only has a single call without considering context.
-   *
-   * <p>For pinned methods (methods kept through Proguard keep rules) and methods that override a
-   * library method this always returns false.
-   */
   public abstract boolean hasSingleCallSite(ProgramMethod method);
 
   public abstract boolean isMultiCallerInlineCandidate(ProgramMethod method);
@@ -48,11 +38,6 @@
     private static final EmptyCallSiteInformation EMPTY_INFO = new EmptyCallSiteInformation();
 
     @Override
-    public boolean hasSingleCallSite(ProgramMethod context, ProgramMethod method) {
-      return false;
-    }
-
-    @Override
     public boolean hasSingleCallSite(ProgramMethod method) {
       return false;
     }
@@ -70,9 +55,7 @@
 
   static class CallGraphBasedCallSiteInformation extends CallSiteInformation {
 
-    // Single callers track their calling context to ensure that the predicate is stable after
-    // inlining of the caller.
-    private final Map<DexMethod, DexMethod> singleCallerMethods = new HashMap<>();
+    private final Set<DexMethod> singleCallerMethods = Sets.newIdentityHashSet();
     private final Set<DexMethod> multiCallerInlineCandidates = Sets.newIdentityHashSet();
 
     CallGraphBasedCallSiteInformation(AppView<AppInfoWithLiveness> appView, CallGraph graph) {
@@ -111,10 +94,7 @@
 
         int numberOfCallSites = node.getNumberOfCallSites();
         if (numberOfCallSites == 1) {
-          Node caller = node.getCallersWithDeterministicOrder().iterator().next();
-          DexMethod existing =
-              singleCallerMethods.put(reference, caller.getMethod().getReference());
-          assert existing == null;
+          singleCallerMethods.add(reference);
         } else if (numberOfCallSites > 1) {
           multiCallerInlineCandidates.add(reference);
         }
@@ -122,25 +102,14 @@
     }
 
     /**
-     * Checks if the given method only has a single call site with the given context.
-     *
-     * <p>For pinned methods (methods kept through Proguard keep rules) and methods that override a
-     * library method this always returns false.
-     */
-    @Override
-    public boolean hasSingleCallSite(ProgramMethod context, ProgramMethod method) {
-      return singleCallerMethods.get(method.getReference()) == context.getReference();
-    }
-
-    /**
-     * Checks if the given method only has a single call without considering context.
+     * Checks if the given method only has a single call site.
      *
      * <p>For pinned methods (methods kept through Proguard keep rules) and methods that override a
      * library method this always returns false.
      */
     @Override
     public boolean hasSingleCallSite(ProgramMethod method) {
-      return singleCallerMethods.containsKey(method.getReference());
+      return singleCallerMethods.contains(method.getReference());
     }
 
     /**
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/MultiCallerInliner.java b/src/main/java/com/android/tools/r8/ir/optimize/MultiCallerInliner.java
index 4b5f0c9..54c8f61 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/MultiCallerInliner.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/MultiCallerInliner.java
@@ -147,11 +147,12 @@
     // We track up to n call sites, where n is the size of multiCallerInliningInstructionLimits.
     if (callers.size() > multiCallerInliningInstructionLimits.length) {
       stopTrackingCallSitesForMethodIfDefinitelyIneligibleForMultiCallerInlining(
-          singleTarget, methodProcessor, callers);
+          method, singleTarget, methodProcessor, callers);
     }
   }
 
   private void stopTrackingCallSitesForMethodIfDefinitelyIneligibleForMultiCallerInlining(
+      ProgramMethod method,
       ProgramMethod singleTarget,
       MethodProcessor methodProcessor,
       ProgramMethodMultiset callers) {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/inliner/DefaultInliningReasonStrategy.java b/src/main/java/com/android/tools/r8/ir/optimize/inliner/DefaultInliningReasonStrategy.java
index 1d3fb28..537150e 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/inliner/DefaultInliningReasonStrategy.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/inliner/DefaultInliningReasonStrategy.java
@@ -53,7 +53,7 @@
       // program.
       return Reason.SIMPLE;
     }
-    if (isSingleCallerInliningTarget(context, target)) {
+    if (isSingleCallerInliningTarget(target)) {
       return Reason.SINGLE_CALLER;
     }
     if (isMultiCallerInlineCandidate(invoke, target, oracle, methodProcessor)) {
@@ -64,8 +64,8 @@
     return Reason.SIMPLE;
   }
 
-  private boolean isSingleCallerInliningTarget(ProgramMethod context, ProgramMethod method) {
-    if (!callSiteInformation.hasSingleCallSite(context, method)) {
+  private boolean isSingleCallerInliningTarget(ProgramMethod method) {
+    if (!callSiteInformation.hasSingleCallSite(method)) {
       return false;
     }
     if (appView.appInfo().isNeverInlineDueToSingleCallerMethod(method)) {
diff --git a/src/test/java/com/android/tools/r8/startup/SingleCallerBridgeStartupTest.java b/src/test/java/com/android/tools/r8/startup/SingleCallerBridgeStartupTest.java
index 1cb68de..4a27e0f 100644
--- a/src/test/java/com/android/tools/r8/startup/SingleCallerBridgeStartupTest.java
+++ b/src/test/java/com/android/tools/r8/startup/SingleCallerBridgeStartupTest.java
@@ -4,9 +4,6 @@
 
 package com.android.tools.r8.startup;
 
-import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
-import static org.hamcrest.MatcherAssert.assertThat;
-
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.TestParametersCollection;
@@ -15,7 +12,6 @@
 import com.android.tools.r8.startup.profile.ExternalStartupItem;
 import com.android.tools.r8.startup.profile.ExternalStartupMethod;
 import com.android.tools.r8.startup.utils.StartupTestingUtils;
-import com.android.tools.r8.utils.codeinspector.ClassSubject;
 import com.google.common.collect.ImmutableList;
 import java.util.Collection;
 import org.junit.Test;
@@ -59,16 +55,9 @@
                     (appView, inlinee, inliningDepth) ->
                         inlinee.getMethodReference().equals(barMethod))
         .setMinApi(parameters)
-        .compile()
-        .inspect(
-            inspector -> {
-              // Assert that foo is not inlined.
-              ClassSubject A = inspector.clazz(A.class);
-              assertThat(A, isPresent());
-              assertThat(A.uniqueMethodWithOriginalName("foo"), isPresent());
-            })
         .run(parameters.getRuntime(), Main.class)
-        .assertSuccessWithOutputLines("A::foo", "A::foo");
+        // TODO(b/285021603): We should not fail here.
+        .assertFailureWithErrorThatThrows(NoSuchMethodError.class);
   }
 
   static class Main {