Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8305324: C2: Wrong execution of vectorizing Interger.reverseBytes #13404

wants to merge 2 commits into from

8305324: C2: Wrong execution of vectorizing Interger.reverseBytes #13404

wants to merge 2 commits into from


Copy link

@quadhier quadhier commented Apr 10, 2023

This patch should fix JDK-8305324.

SuperWord::compute_vector_element_type() propagates backward a narrower integer type when the upper bits of the value are not needed. However, Integer.reverseBytes() depends on higher order bits of an integer and should be prevented from being vectorized like Math.abs()( which is Op_AbsI in the following code).

if (same_type) {
// In any Java arithmetic operation, operands of small integer types
// (boolean, byte, char & short) should be promoted to int first. As
// vector elements of small types don't have upper bits of int, for
// RShiftI or AbsI operations, the compiler has to know the precise
// signedness info of the 1st operand. These operations shouldn't be
// vectorized if the signedness info is imprecise.
const Type* vt = vtn;
int op = in->Opcode();
if (VectorNode::is_shift_opcode(op) || op == Op_AbsI) {
Node* load = in->in(1);

I have tested this patch for tier 1-3 on x86-64.


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


  • JDK-8305324: C2: Wrong execution of vectorizing Interger.reverseBytes


Using git

Checkout this PR locally:
$ git fetch pull/13404/head:pull/13404
$ git checkout pull/13404

Update a local copy of the PR:
$ git checkout pull/13404
$ git pull pull/13404/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13404

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

Using diff file

Download this PR as a diff file:


Link to Webrev Comment

Copy link

bridgekeeper bot commented Apr 10, 2023

👋 Welcome back quadhier! 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.

Copy link

openjdk bot commented Apr 10, 2023

⚠️ @quadhier a branch with the same name as the source branch for this pull request (master) is present in the target repository. If you eventually integrate this pull request then the branch master in your personal fork will diverge once you sync your personal fork with the upstream repository.

To avoid this situation, create a new branch for your changes and reset the master branch. You can do this by running the following commands in a local repository for your personal fork. Note: you do not have to name the new branch NEW-BRANCH-NAME.

$ git checkout -b NEW-BRANCH-NAME
$ git branch -f master db174a15d18eb8ea9c826592b88f8e690112eaaf
$ git push -f origin master

Then proceed to create a new pull request with NEW-BRANCH-NAME as the source branch and close this one.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 10, 2023
Copy link

openjdk bot commented Apr 10, 2023

@quadhier 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 added the hotspot-compiler label Apr 10, 2023
Copy link

mlbridge bot commented Apr 10, 2023


Copy link
Contributor Author

Sorry, I forgot to enable the pre-submit test. I will close this PR and create a new one.

@quadhier quadhier closed this Apr 10, 2023
Copy link
Contributor Author

Please refer to the new PR #13406. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
hotspot-compiler rfr Pull request is ready for review
1 participant