JDK-8287794 : Reverse*VNode::Identity problem
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19,20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-06-03
  • Updated: 2022-08-04
  • Resolved: 2022-07-28
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 b09Fixed
Related Reports
Relates :  
Description
(synopsis is provisional, feel free to change as you see fit)

SonarCloud reports that the if-else-branch in Reverse*VNode::Identity has the same code:

Node* ReverseBytesVNode::Identity(PhaseGVN* phase) {
  if (is_predicated_using_blend()) {
    return this;
  }
  // ReverseBytesV (ReverseBytesV X , MASK) , MASK =>  X
  if (in(1)->Opcode() == Op_ReverseBytesV) {
    if (is_predicated_vector() && in(1)->is_predicated_vector() && in(2) == in(1)->in(2)) {
      return in(1)->in(1);
    } else {
      // ReverseBytesV (ReverseBytesV X) =>  X
      return in(1)->in(1);
    }
  }
  return this;
}

Seems to me the first condition checks that MASKs are the same in both nodes. But if they are not, we are falling to "else" branch, where we do the same transformation anyway. So, there might be a bug lurking there when MASKs are different.
Comments
Changeset: 471a427d Author: Jatin Bhateja <jbhateja@openjdk.org> Date: 2022-07-28 11:08:38 +0000 URL: https://git.openjdk.org/jdk/commit/471a427d1023ee5948d9e58ba04ecabaa7a4db97
28-07-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9623 Date: 2022-07-23 17:39:27 +0000
24-07-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk19/pull/153 Date: 2022-07-22 17:24:04 +0000
22-07-2022

Hi [~jbhateja], just a quick reminder, as this is a P4 bug, it will be deferred to JDK 20 after the fork.
07-06-2022

[~jbhateja], please take a look.
04-06-2022

ILW = Possible wrong Identity transformation in ReverseBytesVNode, no known cases, no workaround = MLH = P4
03-06-2022