Mercurial > hg > graal-jvmci-8
diff src/share/vm/opto/loopnode.cpp @ 22842:0a5d68482373
8072753: Nondeterministic wrong answer on arithmetic
Summary: Check for overflow when inverting the loop during the counted loop conversion
Reviewed-by: kvn
author | iveresov |
---|---|
date | Tue, 17 Feb 2015 11:00:18 -0800 |
parents | 78bbf4d43a14 |
children | c1091733abe6 |
line wrap: on
line diff
--- a/src/share/vm/opto/loopnode.cpp Tue Feb 17 19:59:05 2015 -0800 +++ b/src/share/vm/opto/loopnode.cpp Tue Feb 17 11:00:18 2015 -0800 @@ -436,6 +436,19 @@ return false; // cyclic loop or this loop trips only once } + if (phi_incr != NULL) { + // check if there is a possiblity of IV overflowing after the first increment + if (stride_con > 0) { + if (init_t->_hi > max_jint - stride_con) { + return false; + } + } else { + if (init_t->_lo < min_jint - stride_con) { + return false; + } + } + } + // ================================================= // ---- SUCCESS! Found A Trip-Counted Loop! ----- //