Mercurial > hg > graal-compiler
diff graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java @ 16617:c164a505fc23
Properly handle multiple copies of the same test when unswitching
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 29 Jul 2014 17:40:22 -0700 |
parents | 882f4cb7cfcf |
children | 5d468add216f |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java Tue Jul 29 17:40:15 2014 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java Tue Jul 29 17:40:22 2014 -0700 @@ -42,7 +42,7 @@ /** * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain * key.length + 1 entries, the last entry describes the default (fall through) case. - * + * * @param value the instruction producing the value being switched on * @param successors the list of successors * @param keys the sorted list of keys @@ -68,7 +68,7 @@ /** * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain * key.length + 1 entries, the last entry describes the default (fall through) case. - * + * * @param value the instruction producing the value being switched on * @param successorCount the number of successors * @param keys the sorted list of keys @@ -86,7 +86,7 @@ /** * Gets the key at the specified index. - * + * * @param i the index * @return the key at that index */ @@ -101,6 +101,15 @@ } @Override + public boolean equalKeys(SwitchNode switchNode) { + if (!(switchNode instanceof IntegerSwitchNode)) { + return false; + } + IntegerSwitchNode other = (IntegerSwitchNode) switchNode; + return Arrays.equals(keys, other.keys); + } + + @Override public void generate(NodeLIRBuilderTool gen) { gen.emitSwitch(this); }