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