Skip to content

8387073: C2: StoreNode::Ideal wrongly optimizes away scalar store before masked vector store#31695

Open
mhaessig wants to merge 3 commits into
openjdk:masterfrom
mhaessig:JDK-8387073-masked
Open

8387073: C2: StoreNode::Ideal wrongly optimizes away scalar store before masked vector store#31695
mhaessig wants to merge 3 commits into
openjdk:masterfrom
mhaessig:JDK-8387073-masked

Conversation

@mhaessig

@mhaessig mhaessig commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

StoreNode::Ideal() optimizes back-to-back stores to the same address by removing the earlier store if it is the same size or narrower than the later store when we have UseAVX >= 3 or UseSVE > 0. This optimization is incorrect if the later store is a masked vector store as it might not overwrite all bits of the preceding store.

This PR fixes this issue by plainly disabling the optimization for masked stores. We could conceivably enable the optimization for masked stores if we can prove that the mask overwrites all of the preceding store, but this fix is aimed at correctness before the 27 release. Thus, such optimizations are filed as follow-up RFEs.

Testing:

  • Github Actions
  • tier1,tier2,tier3 plus additional stress testing and an additional run on AVX-512 machines only.
  • tier4,tier5


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8387073: C2: StoreNode::Ideal wrongly optimizes away scalar store before masked vector store (Bug - P4)(⚠️ The fixVersion in this issue is [27] but the fixVersion in .jcheck/conf is 28, a new backport will be created when this pr is integrated.)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31695/head:pull/31695
$ git checkout pull/31695

Update a local copy of the PR:
$ git checkout pull/31695
$ git pull https://git.openjdk.org/jdk.git pull/31695/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 31695

View PR using the GUI difftool:
$ git pr show -t 31695

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31695.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper

bridgekeeper Bot commented Jun 26, 2026

Copy link
Copy Markdown

👋 Welcome back mhaessig! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk

openjdk Bot commented Jun 26, 2026

Copy link
Copy Markdown

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Jun 26, 2026
@openjdk

openjdk Bot commented Jun 26, 2026

Copy link
Copy Markdown

@mhaessig The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk

openjdk Bot commented Jun 26, 2026

Copy link
Copy Markdown

The total number of required reviews for this PR has been set to 2 based on the presence of this label: hotspot-compiler. This can be overridden with the /reviewers command.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Jun 26, 2026
@mlbridge

mlbridge Bot commented Jun 26, 2026

Copy link
Copy Markdown

Webrevs

@mhaessig mhaessig marked this pull request as draft June 26, 2026 14:59
@mhaessig mhaessig force-pushed the JDK-8387073-masked branch from 11644fc to 28eab9b Compare June 26, 2026 15:00
@openjdk openjdk Bot removed the rfr Pull request is ready for review label Jun 26, 2026
@mhaessig mhaessig marked this pull request as ready for review June 26, 2026 15:00
@openjdk openjdk Bot added the rfr Pull request is ready for review label Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant