is this unreachable code? (ConditionalEliminationPhase)

Garcia Gutierrez Miguel Alfredo miguelalfredo.garcia at epfl.ch
Sun Dec 29 09:48:55 PST 2013


There appears to be unreachable code in ConditionalEliminationPhase. I've included comments in-line, below.

--
Miguel Garcia
Swiss Federal Institute of Technology
EPFL - IC - LAMP1 - INR 328 - Station 14
CH-1015 Lausanne - Switzerland
http://lamp.epfl.ch/~magarcia/


diff -r 72e2ec923b7b graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java  Sat Dec 21 13:47:36 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java  Sun Dec 29 18:44:15 2013 +0100
@@ -395,7 +395,7 @@
             }
         }

-        private void registerGuard(GuardNode guard) {
+        private void registerGuard(final GuardNode guard) {
             LogicNode condition = guard.condition();

             ValueNode existingGuards = guard.negated() ? state.falseConditions.get(condition) : state.trueConditions.get(condition);
@@ -407,6 +407,9 @@
                 ValueNode anchor = state.trueConditions.get(condition);
                 if (anchor != null) {
                     if (!guard.negated()) {
+                        // Unreachable:
+                        //   `!guard.negated() && state.trueConditions.get(condition) != null`
+                        // already covered by then-branch of this method's first `if`.
                         guard.replaceAtUsages(anchor);
                         metricGuardsRemoved.increment();
                         GraphUtil.killWithUnusedFloatingInputs(guard);
@@ -415,6 +418,9 @@
                     anchor = state.falseConditions.get(condition);
                     if (anchor != null) {
                         if (guard.negated()) {
+                            // Unreachable:
+                            //   `guard.negated() && state.falseConditions.get(condition) != null`
+                            // already covered by then-branch of this method's first `if`.
                             guard.replaceAtUsages(anchor);
                             metricGuardsRemoved.increment();
                             GraphUtil.killWithUnusedFloatingInputs(guard);



More information about the graal-dev mailing list