changeset 9309:83992e8ebc7b

Delay the reporting of an error in the branch probability injection node.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 25 Apr 2013 18:17:24 +0200
parents 2b62ddcf8fd8
children b0f9ab5a185b
files graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BranchProbabilityNode.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BranchProbabilityNode.java	Thu Apr 25 18:11:30 2013 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BranchProbabilityNode.java	Thu Apr 25 18:17:24 2013 +0200
@@ -69,7 +69,7 @@
             }
             BeginNode begin = (BeginNode) current;
             if (!(begin.predecessor() instanceof IfNode)) {
-                throw new GraalInternalError("Injected branch probability cannot follow a merge, only if nodes");
+                return;
             }
             IfNode ifNode = (IfNode) begin.predecessor();
             if (ifNode.trueSuccessor() == begin) {
@@ -92,7 +92,11 @@
 
     @Override
     public void lower(LoweringTool tool, LoweringType loweringType) {
-        throw new GraalInternalError("Branch probability could not be injected, because the probability value did not reduce to a constant value.");
+        if (probability.isConstant()) {
+            throw new GraalInternalError("Injected branch probability must follow an if node.");
+        } else {
+            throw new GraalInternalError("Branch probability could not be injected, because the probability value did not reduce to a constant value.");
+        }
     }
 
 }