Skip to content

Commit 256356d

Browse files
committed
8274130: C2: MulNode::Ideal chained transformations may act on wrong nodes
Reviewed-by: kvn Backport-of: 756d22c3563ac92e74bb68d5eecb86d4fbab2c6b
1 parent 8ce6877 commit 256356d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/hotspot/share/opto/mulnode.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,11 @@ Node* MulNode::Identity(PhaseGVN* phase) {
5959
// We also canonicalize the Node, moving constants to the right input,
6060
// and flatten expressions (so that 1+x+2 becomes x+3).
6161
Node *MulNode::Ideal(PhaseGVN *phase, bool can_reshape) {
62-
const Type *t1 = phase->type( in(1) );
63-
const Type *t2 = phase->type( in(2) );
64-
Node *progress = NULL; // Progress flag
62+
Node* in1 = in(1);
63+
Node* in2 = in(2);
64+
Node* progress = NULL; // Progress flag
6565

6666
// convert "max(a,b) * min(a,b)" into "a*b".
67-
Node *in1 = in(1);
68-
Node *in2 = in(2);
6967
if ((in(1)->Opcode() == max_opcode() && in(2)->Opcode() == min_opcode())
7068
|| (in(1)->Opcode() == min_opcode() && in(2)->Opcode() == max_opcode())) {
7169
Node *in11 = in(1)->in(1);
@@ -83,10 +81,15 @@ Node *MulNode::Ideal(PhaseGVN *phase, bool can_reshape) {
8381
igvn->_worklist.push(in1);
8482
igvn->_worklist.push(in2);
8583
}
84+
in1 = in(1);
85+
in2 = in(2);
8686
progress = this;
8787
}
8888
}
8989

90+
const Type* t1 = phase->type(in1);
91+
const Type* t2 = phase->type(in2);
92+
9093
// We are OK if right is a constant, or right is a load and
9194
// left is a non-constant.
9295
if( !(t2->singleton() ||

0 commit comments

Comments
 (0)