Mercurial > hg > graal-compiler
changeset 23107:d5ffcf15ebeb
Fix bug in counted loop detection.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 30 Nov 2015 17:17:49 +0100 |
parents | fd3b0d8cf1f7 |
children | 319230b97faf |
files | graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CountedLoopTest.java graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java |
diffstat | 2 files changed, 33 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CountedLoopTest.java Mon Nov 30 11:31:35 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CountedLoopTest.java Mon Nov 30 17:17:49 2015 +0100 @@ -269,4 +269,37 @@ return true; } + public static Result incrementNeqSnippet(int limit) { + int i; + int posLimit = ((limit - 1) & 0xFFFF) + 1; // make sure limit is always strictly positive + Result ret = new Result(); + for (i = 0; i != posLimit; i++) { + GraalDirectives.controlFlowAnchor(); + ret.extremum = get(InductionVariable::extremumNode, i); + } + ret.exitValue = get(InductionVariable::exitValueNode, i); + return ret; + } + + @Test + public void decrementNeq() { + test("decrementNeqSnippet", 256); + } + + public static Result decrementNeqSnippet(int limit) { + int i; + int posLimit = ((limit - 1) & 0xFFFF) + 1; // make sure limit is always strictly positive + Result ret = new Result(); + for (i = posLimit; i != 0; i--) { + GraalDirectives.controlFlowAnchor(); + ret.extremum = get(InductionVariable::extremumNode, i); + } + ret.exitValue = get(InductionVariable::exitValueNode, i); + return ret; + } + + @Test + public void incrementNeq() { + test("incrementNeqSnippet", 256); + } }