JDK-8259777 : Incorrect predication condition generated by ADLC
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,16,17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • CPU: generic
  • Submitted: 2021-01-14
  • Updated: 2021-03-10
  • Resolved: 2021-01-15
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 11 JDK 16 JDK 17
11.0.12-oracleFixed 16.0.1Fixed 17 b06Fixed
Description
Please consider following instruction selection pattern:-
   match(Set dst (VectorBlend (Binary src1 (AddVB src1 src2)) mask));

Currently, ADLC emits following predication check for src1 in matcher DFA.
   /*src1*/(_kids[0]->_kids[0]->_leaf == _kids[1]->_kids[0]->_leaf) 

src1 appears twice in the State tree corresponding to this pattern, first as the leaf of left child state of Binary node which is left child state of VectorBlend and secondly as the leaf of left child of AddVB which is the right child state of Binary node. Thus following is the correct predication check to test both the occurrences of src1.

   /*src1*/(_kids[0]->_kids[0]->_leaf == _kids[0]->_kids[1]->_kids[0]->_leaf)


Comments
Fix Request (11u) This fixes the C2 bug, and keeps codebases in sync (I see 11.0.12-oracle). Patch applies cleanly to 11u, passes tier{1,2}.
09-03-2021

Fix Request (JDK 16u): This bug may lead to generation of incorrect code in C2. The fix is low risk. The patch applies cleanly to JDK 16u.
28-01-2021

Changeset: bcf20a0d Author: Jatin Bhateja <jbhateja@openjdk.org> Date: 2021-01-15 15:03:04 +0000 URL: https://git.openjdk.java.net/jdk/commit/bcf20a0d
15-01-2021