JDK-8354303 : C2 SuperWord: Aliasing Analysis: newly allocated arrays cannot alias
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-04-10
  • Updated: 2025-04-11
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.
Other
tbdUnresolved
Related Reports
Relates :  
Description
This could be done independently, or as a follow-up to JDK-8324751.

Sometimes, an array is allocated, and then directly some data
is computed into it from another array that existed before.

Example:
short[] res = new short[SIZE];
for (int i = 1; i < SIZE / 2; i++) {
    res[i] *= shorts[i - 1];
}

Currently, we cannot always vectorize because we assume that the
original and the newly allocated arrays could alias, but that is not
possible. We should try to detect such newly allocated arrays,
and remove aliasing edges for them.

We have to be a little careful with escaping array references though.
Maybe we can just prove that the original array reference existed
before the allocation?
Comments
[~thartmann] said we should look at escape analysis for this too, but we are not sure that it gives us sufficient information.
11-04-2025