Mercurial > hg > graal-compiler
changeset 16672:f2cd7b3d5aef
unswitching: check full SwitchNode structure
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 01 Aug 2014 15:19:26 +0200 |
parents | 7cdd7ede912d |
children | 9a8f4c9e11a8 |
files | graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java |
diffstat | 2 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java Fri Jul 25 13:12:32 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java Fri Aug 01 15:19:26 2014 +0200 @@ -167,7 +167,7 @@ invariantValue = switchNode.value(); controls = new ArrayList<>(); controls.add(switchNode); - } else if (switchNode.value() == invariantValue && firstSwitch.equalKeys(switchNode)) { + } else if (switchNode.value() == invariantValue && firstSwitch.structureEquals(switchNode)) { // Only collect switches which test the same values in the same order controls.add(switchNode); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Fri Jul 25 13:12:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Fri Aug 01 15:19:26 2014 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.nodes.extended; +import java.util.*; + import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.compiler.common.type.*; @@ -103,6 +105,10 @@ */ public abstract Constant keyAt(int i); + public boolean structureEquals(SwitchNode switchNode) { + return Arrays.equals(keySuccessors, switchNode.keySuccessors) && equalKeys(switchNode); + } + /** * Returns true if the switch has the same keys in the same order as this switch. */