changeset 9839:b360b05aa996

Quick fix for BranchProbabilityNode.
author Andreas Woess <andreas.woess@jku.at>
date Thu, 16 May 2013 14:33:35 +0200
parents d59af238b0e9
children e6df511677da
files graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BranchProbabilityNode.java
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BranchProbabilityNode.java	Tue May 28 16:44:25 2013 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BranchProbabilityNode.java	Thu May 16 14:33:35 2013 +0200
@@ -92,6 +92,9 @@
                 }
             }
             if (!couldSet) {
+                if (isSubstitutionGraph()) {
+                    return this;
+                }
                 throw new GraalInternalError("Wrong usage of branch probability injection!");
             }
             return condition;
@@ -99,6 +102,10 @@
         return this;
     }
 
+    private boolean isSubstitutionGraph() {
+        return usages().count() == 1 && usages().first() instanceof ReturnNode && condition instanceof LocalNode;
+    }
+
     /**
      * This intrinsic should only be used for the condition of an if statement. The parameter
      * condition should also only denote a simple condition and not a combined condition involving