changeset 11783:9c98944c040b

make GuardingPiNode canonicalize to a deopt when the guard is guaranteed to fail
author Doug Simon <doug.simon@oracle.com>
date Wed, 25 Sep 2013 12:17:21 +0200
parents 106bd0ff2498
children a2958b7bf83f
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java	Wed Sep 25 12:16:26 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java	Wed Sep 25 12:17:21 2013 +0200
@@ -94,8 +94,17 @@
 
     @Override
     public ValueNode canonical(CanonicalizerTool tool) {
+        if (stamp() == StampFactory.illegal(object.kind())) {
+            // The condition always fails
+            return graph().add(new DeoptimizeNode(action, reason));
+        }
         if (condition instanceof LogicConstantNode) {
             LogicConstantNode c = (LogicConstantNode) condition;
+            if (c.getValue() == negated) {
+                // The condition always fails
+                return graph().add(new DeoptimizeNode(action, reason));
+            }
+
             if (c.getValue() != negated && stamp().equals(object().stamp())) {
                 return object;
             }