Hi,

This PR adds intrinsics to `Preconditions.checkFromToIndex()` and 
`Preconditions.checkFromIndexSize()` to produced optimized IR that uses 
`RangeCheck` node instead of implicit comparisons. `Preconditions.checkIndex()` 
is also refactored (without additional optimizations) to use the same helper 
function.

Some common patterns where calling `checkFromToIndex` or `checkFromIndexSize` 
in a loop can have range checks in main loop eliminated completely and, 
therefore, enables empty loop removal.

IR and correctness tests are included and passing. Additional tests on 
`Preconditions.checkIndex()` were also added.

Thanks!

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - Merge branch 'master' into check-index-sub-range
 - fix TestRangeCheck
 - enable intrinsic control for release builds
 - fix TestOpaqueConstantBoolNodes
 - adjust benchmark iterations
 - Merge remote-tracking branch 'upstream/master' into 
check-index-sub-range-bench
 - update benchmarks
 - update tests with deopt on length=max
 - improve checkFromToIndex RCE hoisting
 - WIP
 - ... and 32 more: https://git.openjdk.org/jdk/compare/6994a51e...ddd1ac3f

Changes: https://git.openjdk.org/jdk/pull/31138/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31138&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8361837
  Stats: 1152 lines in 12 files changed: 1110 ins; 8 del; 34 mod
  Patch: https://git.openjdk.org/jdk/pull/31138.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31138/head:pull/31138

PR: https://git.openjdk.org/jdk/pull/31138

Reply via email to