> 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).
Kangcheng Xu has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 48 commits: - Merge branch 'master' into check-index-sub-range - fix type widening, add comments - explicit nullptr check, add type cast, add clarifications in comments - simplify logic by allowing deopt with size == 0 - remove left over code - Merge branch 'master' into check-index-sub-range - Merge branch 'master' into check-index-sub-range - fix TestRangeCheck - enable intrinsic control for release builds - fix TestOpaqueConstantBoolNodes - ... and 38 more: https://git.openjdk.org/jdk/compare/01b36384...55f42e15 ------------- Changes: https://git.openjdk.org/jdk/pull/31138/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31138&range=05 Stats: 1133 lines in 10 files changed: 1091 ins; 2 del; 40 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
