gt:         return assertNotInGraph(graph, Invoke.class);
context: /*
   * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
   *
   * This code is distributed in the hope that it will be useful, but WITHOUT
   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   * version 2 for more details (a copy is included in the LICENSE file that
   * accompanied this code).
   *
   * You should have received a copy of the GNU General Public License version
   * 2 along with this work; if not, write to the Free Software Foundation,
   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   *
   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   */
  package com.oracle.graal.compiler.test.inlining;
  
  import jdk.internal.jvmci.code.InfopointReason;
  import jdk.internal.jvmci.meta.ResolvedJavaMethod;
  
  import org.junit.Ignore;
  import org.junit.Test;
  
  import com.oracle.graal.compiler.test.GraalCompilerTest;
  import com.oracle.graal.debug.Debug;
  import com.oracle.graal.debug.Debug.Scope;
  import com.oracle.graal.debug.DebugDumpScope;
  import com.oracle.graal.graph.Node;
  import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration;
  import com.oracle.graal.nodes.FullInfopointNode;
  import com.oracle.graal.nodes.Invoke;
  import com.oracle.graal.nodes.StructuredGraph;
  import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
  import com.oracle.graal.phases.OptimisticOptimizations;
  import com.oracle.graal.phases.PhaseSuite;
  import com.oracle.graal.phases.common.CanonicalizerPhase;
  import com.oracle.graal.phases.common.DeadCodeEliminationPhase;
  import com.oracle.graal.phases.common.inlining.InliningPhase;
  import com.oracle.graal.phases.tiers.HighTierContext;
  
  public class InliningTest extends GraalCompilerTest {
  
      @Test
      public void testInvokeStaticInlining() {
          assertInlined(getGraph("invokeStaticSnippet", false));
          assertInlined(getGraph("invokeStaticOnInstanceSnippet", false));
      }
  
      @SuppressWarnings("all")
      public static Boolean invokeStaticSnippet(boolean value) {
          return Boolean.valueOf(value);
      }
  
      @SuppressWarnings({"all", "static"})
      public static Boolean invokeStaticOnInstanceSnippet(Boolean obj, boolean value) {
          return obj.valueOf(value);
      }
  
      @Test
      public void testStaticBindableInlining() {
          assertInlined(getGraph("invokeConstructorSnippet", false));
          assertInlined(getGraph("invokeFinalMethodSnippet", false));
          assertInlined(getGraph("invokeMethodOnFinalClassSnippet", false));
          assertInlined(getGraph("invokeMethodOnStaticFinalFieldSnippet", false));
      }
  
      @Ignore("would need read elimination/EA before inlining")
      @Test
      public void testDependentStaticBindableInlining() {
          assertInlined(getGraph("invokeMethodOnFinalFieldSnippet", false));
          assertInlined(getGraph("invokeMethodOnFieldSnippet", false));
      }
  
      @Test
      public void testStaticBindableInliningIP() {
          assertManyMethodInfopoints(assertInlined(getGraph("invokeConstructorSnippet", true)));
          assertManyMethodInfopoints(assertInlined(getGraph("invokeFinalMethodSnippet", true)));
          assertManyMethodInfopoints(assertInlined(getGraph("invokeMethodOnFinalClassSnippet", true)));
          assertManyMethodInfopoints(assertInlined(getGraph("invokeMethodOnStaticFinalFieldSnippet", true)));
      }
  
      @Ignore("would need read elimination/EA before inlining")
      @Test
      public void testDependentStaticBindableInliningIP() {
          assertManyMethodInfopoints(assertInlined(getGraph("invokeMethodOnFinalFieldSnippet", true)));
          assertManyMethodInfopoints(assertInlined(getGraph("invokeMethodOnFieldSnippet", true)));
      }
  
      @SuppressWarnings("all")
      public static Object invokeConstructorSnippet(int value) {
          return new SuperClass(value);
      }
  
      @SuppressWarnings("all")
      public static int invokeFinalMethodSnippet(SuperClass superClass, SubClassA subClassA, FinalSubClass finalSubClass) {
          return superClass.publicFinalMethod() + subClassA.publicFinalMethod() + finalSubClass.publicFinalMethod() + superClass.protectedFinalMethod() + subClassA.protectedFinalMethod() +
                          finalSubClass.protectedFinalMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeMethodOnFinalClassSnippet(FinalSubClass finalSubClass) {
          return finalSubClass.publicFinalMethod() + finalSubClass.publicNotOverriddenMethod() + finalSubClass.publicOverriddenMethod() + finalSubClass.protectedFinalMethod() +
                          finalSubClass.protectedNotOverriddenMethod() + finalSubClass.protectedOverriddenMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeMethodOnStaticFinalFieldSnippet() {
          return StaticFinalFields.NumberStaticFinalField.intValue() + StaticFinalFields.SuperClassStaticFinalField.publicOverriddenMethod() +
                          StaticFinalFields.FinalSubClassStaticFinalField.publicOverriddenMethod() + StaticFinalFields.SingleImplementorStaticFinalField.publicOverriddenMethod() +
                          StaticFinalFields.MultipleImplementorsStaticFinalField.publicOverriddenMethod() + StaticFinalFields.SubClassAStaticFinalField.publicOverriddenMethod() +
                          StaticFinalFields.SubClassBStaticFinalField.publicOverriddenMethod() + StaticFinalFields.SubClassCStaticFinalField.publicOverriddenMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeMethodOnFinalFieldSnippet() {
          FinalFields fields = new FinalFields();
          return fields.numberFinalField.intValue() + fields.superClassFinalField.publicOverriddenMethod() + fields.finalSubClassFinalField.publicOverriddenMethod() +
                          fields.singleImplementorFinalField.publicOverriddenMethod() + fields.multipleImplementorsFinalField.publicOverriddenMethod() +
                          fields.subClassAFinalField.publicOverriddenMethod() + fields.subClassBFinalField.publicOverriddenMethod() + fields.subClassCFinalField.publicOverriddenMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeMethodOnFieldSnippet() {
          Fields fields = new Fields();
          return fields.numberField.intValue() + fields.superClassField.publicOverriddenMethod() + fields.finalSubClassField.publicOverriddenMethod() +
                          fields.singleImplementorField.publicOverriddenMethod() + fields.multipleImplementorsField.publicOverriddenMethod() + fields.subClassAField.publicOverriddenMethod() +
                          fields.subClassBField.publicOverriddenMethod() + fields.subClassCField.publicOverriddenMethod();
      }
  
      public interface Attributes {
  
          int getLength();
      }
  
      public class NullAttributes implements Attributes {
  
          @Override
          public int getLength() {
              return 0;
          }
  
      }
  
      public class TenAttributes implements Attributes {
  
          @Override
          public int getLength() {
              return 10;
          }
  
      }
  
      public int getAttributesLength(Attributes a) {
          return a.getLength();
      }
  
      @Test
      public void testGuardedInline() {
          NullAttributes nullAttributes = new NullAttributes();
          for (int i = 0; i < 10000; i++) {
              getAttributesLength(nullAttributes);
          }
          getAttributesLength(new TenAttributes());
  
          test("getAttributesLength", nullAttributes);
          test("getAttributesLength", (Object) null);
      }
  
      @Test
      public void testClassHierarchyAnalysis() {
          assertInlined(getGraph("invokeLeafClassMethodSnippet", false));
          assertInlined(getGraph("invokeConcreteMethodSnippet", false));
          assertInlined(getGraph("invokeSingleImplementorInterfaceSnippet", false));
          // assertInlined(getGraph("invokeConcreteInterfaceMethodSnippet", false));
  
          assertNotInlined(getGraph("invokeOverriddenPublicMethodSnippet", false));
          assertNotInlined(getGraph("invokeOverriddenProtectedMethodSnippet", false));
          assertNotInlined(getGraph("invokeOverriddenInterfaceMethodSnippet", false));
      }
  
      @Test
      public void testClassHierarchyAnalysisIP() {
          assertManyMethodInfopoints(assertInlined(getGraph("invokeLeafClassMethodSnippet", true)));
          assertManyMethodInfopoints(assertInlined(getGraph("invokeConcreteMethodSnippet", true)));
          assertManyMethodInfopoints(assertInlined(getGraph("invokeSingleImplementorInterfaceSnippet", true)));
          //@formatter:off
          // assertInlineInfopoints(assertInlined(getGraph("invokeConcreteInterfaceMethodSnippet", true)));
          //@formatter:on
  
          assertFewMethodInfopoints(assertNotInlined(getGraph("invokeOverriddenPublicMethodSnippet", true)));
          assertFewMethodInfopoints(assertNotInlined(getGraph("invokeOverriddenProtectedMethodSnippet", true)));
          assertFewMethodInfopoints(assertNotInlined(getGraph("invokeOverriddenInterfaceMethodSnippet", true)));
      }
  
      @SuppressWarnings("all")
      public static int invokeLeafClassMethodSnippet(SubClassA subClassA) {
          return subClassA.publicFinalMethod() + subClassA.publicNotOverriddenMethod() + subClassA.publicOverriddenMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeConcreteMethodSnippet(SuperClass superClass) {
          return superClass.publicNotOverriddenMethod() + superClass.protectedNotOverriddenMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeSingleImplementorInterfaceSnippet(SingleImplementorInterface testInterface) {
          return testInterface.publicNotOverriddenMethod() + testInterface.publicOverriddenMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeConcreteInterfaceMethodSnippet(MultipleImplementorsInterface testInterface) {
          return testInterface.publicNotOverriddenMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeOverriddenInterfaceMethodSnippet(MultipleImplementorsInterface testInterface) {
          return testInterface.publicOverriddenMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeOverriddenPublicMethodSnippet(SuperClass superClass) {
          return superClass.publicOverriddenMethod();
      }
  
      @SuppressWarnings("all")
      public static int invokeOverriddenProtectedMethodSnippet(SuperClass superClass) {
          return superClass.protectedOverriddenMethod();
      }
  
      @SuppressWarnings("try")
      private StructuredGraph getGraph(final String snippet, final boolean eagerInfopointMode) {
          try (Scope s = Debug.scope("InliningTest", new DebugDumpScope(snippet))) {
              ResolvedJavaMethod method = getResolvedJavaMethod(snippet);
              StructuredGraph graph = eagerInfopointMode ? parseDebug(method, AllowAssumptions.YES) : parseEager(method, AllowAssumptions.YES);
              PhaseSuite<HighTierContext> graphBuilderSuite = eagerInfopointMode ? getCustomGraphBuilderSuite(GraphBuilderConfiguration.getFullDebugDefault(getDefaultGraphBuilderPlugins()))
                              : getDefaultGraphBuilderSuite();
              HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
              Debug.dump(graph, "Graph");
              new CanonicalizerPhase().apply(graph, context);
              new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
              Debug.dump(graph, "Graph");
              new CanonicalizerPhase().apply(graph, context);
              new DeadCodeEliminationPhase().apply(graph);
              return graph;
          } catch (Throwable e) {
              throw Debug.handle(e);
          }
      }
  
      private static StructuredGraph assertInlined(StructuredGraph graph) {
  