Mercurial > hg > graal-compiler
changeset 23162:59bb4f5ec80e
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 13 Dec 2015 11:27:58 +0100 |
parents | dfae34f1fe9b (diff) c01c5942b880 (current diff) |
children | 3cbe2cc6c9ef |
files | graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/FoldPluginGenerator.java graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/NodeIntrinsicPluginGenerator.java |
diffstat | 2 files changed, 38 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest5.java Sat Dec 12 00:29:57 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest5.java Sun Dec 13 11:27:58 2015 +0100 @@ -24,6 +24,8 @@ import org.junit.Test; +import com.oracle.graal.api.directives.GraalDirectives; + /** * Collection of tests for * {@link com.oracle.graal.phases.common.DominatorConditionalEliminationPhase} including those that @@ -43,16 +45,14 @@ static final class DistinctB { } - @SuppressWarnings("all") - public static int reference1Snippet(A a, B b) { + public static int reference1Snippet(Object a) { if (a instanceof B) { return 1; } return 2; } - @SuppressWarnings("all") - public static int test1Snippet(A a, B b) { + public static int test1Snippet(Object a) { if (a instanceof B) { if (a instanceof A) { return 1; @@ -117,4 +117,37 @@ public void test3() { testConditionalElimination("test3Snippet", "reference3Snippet", true); } + + public static int reference4Snippet(Object a) { + if (!(a instanceof B)) { + GraalDirectives.deoptimize(); + } + return 1; + } + + public static int test4Snippet1(Object a) { + if (!(a instanceof B)) { + GraalDirectives.deoptimize(); + } + if (!(a instanceof A)) { + GraalDirectives.deoptimize(); + } + return 1; + } + + public static int test4Snippet2(Object a) { + if (!(a instanceof A)) { + GraalDirectives.deoptimize(); + } + if (!(a instanceof B)) { + GraalDirectives.deoptimize(); + } + return 1; + } + + @Test + public void test4() { + testConditionalElimination("test4Snippet1", "reference4Snippet"); + testConditionalElimination("test4Snippet2", "reference4Snippet"); + } }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DominatorConditionalEliminationPhase.java Sat Dec 12 00:29:57 2015 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DominatorConditionalEliminationPhase.java Sun Dec 13 11:27:58 2015 +0100 @@ -648,7 +648,7 @@ return rewireGuards(foldResult.first.getGuard(), result.toBoolean(), rewireGuardFunction); } } - if (thisGuard != null && unaryLogicNode.stamp() instanceof IntegerStamp) { + if (thisGuard != null) { Stamp newStamp = unaryLogicNode.getSucceedingStampForValue(thisGuard.isNegated()); if (newStamp != null && foldPendingTest(thisGuard, value, newStamp, rewireGuardFunction)) { return true;