RFR: 8267376: Deduce the final bound of ModXNode
Yi Yang
yyang at openjdk.java.net
Tue May 25 03:25:04 UTC 2021
if the divisor is a constant and not equal to 0, it's possible to deduce the final bound of ModXNode given that the following rules:
x % -y ==> [0, y - 1]
x % y ==> [0, y - 1]
-x % y ==> [-y + 1, 0]
-x % -y ==> [-y + 1, 0]
FYI: The original purpose of this patch is to eliminate array access range check(e.g. `arr[val%5]`) which discussed in https://github.com/openjdk/jdk/pull/4083#issuecomment-846971247, because ModXNode would be transformed to other nodes during IGVN, RangeCheckNode is still generated when accessing array element. Regardless of eliminating array access range check, it still reasonable to deduce the bound of % operation if the divisor is known constant.
-------------
Commit messages:
- trailing whitespaces
- ModXNode::Value
Changes: https://git.openjdk.java.net/jdk/pull/4179/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4179&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8267376
Stats: 88 lines in 1 file changed: 50 ins; 30 del; 8 mod
Patch: https://git.openjdk.java.net/jdk/pull/4179.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4179/head:pull/4179
PR: https://git.openjdk.java.net/jdk/pull/4179
More information about the hotspot-compiler-dev
mailing list