JDK-8266601 : Fix bugs in AddLNode::Ideal transformations
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8,11,16,17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-05-05
  • Updated: 2021-06-02
  • Resolved: 2021-05-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.
JDK 17
17 b22Fixed
Related Reports
Duplicate :  
Relates :  
Description
While writing some tests using the new IR-based test framework (https://github.com/openjdk/jdk/pull/3508) I found the following issues on ADDLNode::Ideal transformations:

// Convert "(a-b)+(c-a)" into "(c-b)"
if( op2 == Op_SubL && in1->in(1) == in1->in(2) ) ...
*** Notice the second part of the comparison.

// Convert "(0-y)+x" into "(x-y)"
if( op1 == Op_SubL && phase->type(in1->in(1)) == TypeInt::ZERO )
*** Should be "TypeLong::ZERO" instead of "TypeInt::ZERO"
*** Actually found by Christian Hagedorn

// Convert "X+X+X...+X+Y" into "k*X+Y" or really convert "X+(X+Y)"
// into "(X<<1)+Y" and let shift-folding happen.
if( op2 == Op_AddL &&
    in2->in(1) == in1 &&
    op1 != Op_ConL &&
    0 ) {

*** The optimization is disabled due the "&& 0" at the end. Later I found that this is being tracked by this issue: https://bugs.openjdk.java.net/browse/JDK-8259624
Comments
Changeset: 67cb22af Author: Cesar <disoares@microsoft.com> Committer: Tobias Hartmann <thartmann@openjdk.org> Date: 2021-05-11 09:28:37 +0000 URL: https://git.openjdk.java.net/jdk/commit/67cb22af58c649e67f0b9f707a65389bcb39a205
11-05-2021