[9] RFR(S): 8043284: Optimize signed integer comparison
Tobias Hartmann
tobias.hartmann at oracle.com
Thu Jul 31 12:35:19 UTC 2014
Hi,
please review the following patch that fixes JDK-8043284.
Bug: https://bugs.openjdk.java.net/browse/JDK-8043284
Webrev: http://cr.openjdk.java.net/~thartmann/8043284/webrev.00/
== Problem ==
Similar to the previous implementation of unsigned integer comparison
(see JDK- 8042786), signed integer comparison does only consider the
general integer range [MinInt, MaxInt] instead of two ranges when
comparing the result of an overflowing AddI/SubI. However, there are
situations where one can prove that both resulting ranges are unequal to
the tested value (see 'TestIntegerComparison::testSigned' in the
webrev). In this case the comparison can be optimized.
== Solution ==
Similar to the fix for JDK-8042786 we compute both type ranges if the
add/sub overflows and compare them to the tested value. If we can prove
that the value is always unequal, we replace the BoolNode by true or
false (depending on the test).
A jtreg test is added that triggers both the unsigned as well as the
signed optimization.
== Testing ==
- Jtreg test (TestIntegerComparison)
- JPRT
Thanks,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140731/d080b191/attachment.html>
More information about the hotspot-compiler-dev
mailing list