RFR: 8278296: Generalize long range check transformation [v2]

Roland Westrelin roland at openjdk.java.net
Mon Jan 24 14:45:41 UTC 2022


> 8259609 (C2: optimize long range checks in long counted loops) only
> covered the case of a counted loop with a positive stride and a range
> check with a positive scale. This change generalizes the long range
> check transformation to all 4 combinations of stride and scale signs.
> 
> The stride > 0, scale > 0 case (covered 8259609) was tweaked so it now
> uses Qmax computed as the inclusive limit of j*K+Q. That helps in
> generalizing the formulas to other cases.
> 
> The addition of PhaseIdealLoop::is_scaled_iv_plus_extra_offset() was
> required for the case of negative scale in an int loop. The range
> check then has the shape:
> 
> (CmpUL (AddL (ConvI2L (SubI ConI (LshiftI (Phi
> 
> with ConI, the zero constant.
> 
> This change also addresses this comment from John:
> 
> https://github.com/openjdk/jdk/pull/6576#discussion_r765343664
> 
> as part of 8276116 (C2: optimize long range checks in int counted loops)

Roland Westrelin has updated the pull request incrementally with two additional commits since the last revision:

 - more review
 - review

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/6989/files
  - new: https://git.openjdk.java.net/jdk/pull/6989/files/1bfb000f..be89df60

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6989&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6989&range=00-01

  Stats: 47 lines in 2 files changed: 10 ins; 13 del; 24 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6989.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6989/head:pull/6989

PR: https://git.openjdk.java.net/jdk/pull/6989


More information about the hotspot-compiler-dev mailing list