JDK-8289996 : Fix array range check hoisting for some scaled loop iv
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 20
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2022-07-08
  • Updated: 2023-08-23
  • Resolved: 2022-07-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20 b08Fixed
Related Reports
Cloners :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Recently we found that in some loops with scaled array accesses, array range checks are not hoisted by loop predication. A typical case is below.

 for (int i = 0; i < size; i++) {
     b[3 * i] = a[3 * i];
 }

Initial investigation found that GVN optimizes the array index "3 * i" into "i << 1 + i" so it's regarded as non-linear.
Comments
Multiple tests fail after this change.
01-08-2022

Sorry for my late reply. From what I have seen, these 3 issues are different and some are test case defect which is exposed by this change. So it's not that trivial to fix all of them. Ok for me to back it out.
31-07-2022

[~pli] What do you think? Is it trivial to fix all these issues or it is simpler to back out these changes so you will have time to redo them (different approach)?
29-07-2022

I'm also in favor of backing out this change.
29-07-2022

May be we should rollback these changes because there are 3 bugs associated with it. Unless there is simple fix which address all 3 issues.
28-07-2022

Changeset: 89390955 Author: Pengfei Li <pli@openjdk.org> Date: 2022-07-26 13:45:38 +0000 URL: https://git.openjdk.org/jdk/commit/893909558b0439e7727208eeb582416ffc4d9b37
26-07-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9508 Date: 2022-07-15 08:07:34 +0000
15-07-2022