Skip to content

Commit 0488ebd

Browse files
committed
8276105: C2: Conv(D|F)2(I|L)Nodes::Ideal should handle rounding correctly
Reviewed-by: kvn, thartmann
1 parent acceffc commit 0488ebd

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/hotspot/share/opto/convertnode.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ const Type* ConvD2INode::Value(PhaseGVN* phase) const {
108108
//------------------------------Ideal------------------------------------------
109109
// If converting to an int type, skip any rounding nodes
110110
Node *ConvD2INode::Ideal(PhaseGVN *phase, bool can_reshape) {
111-
if( in(1)->Opcode() == Op_RoundDouble )
112-
set_req(1,in(1)->in(1));
111+
if (in(1)->Opcode() == Op_RoundDouble) {
112+
set_req(1, in(1)->in(1));
113+
return this;
114+
}
113115
return NULL;
114116
}
115117

@@ -142,8 +144,10 @@ Node* ConvD2LNode::Identity(PhaseGVN* phase) {
142144
//------------------------------Ideal------------------------------------------
143145
// If converting to an int type, skip any rounding nodes
144146
Node *ConvD2LNode::Ideal(PhaseGVN *phase, bool can_reshape) {
145-
if( in(1)->Opcode() == Op_RoundDouble )
146-
set_req(1,in(1)->in(1));
147+
if (in(1)->Opcode() == Op_RoundDouble) {
148+
set_req(1, in(1)->in(1));
149+
return this;
150+
}
147151
return NULL;
148152
}
149153

@@ -179,8 +183,10 @@ Node* ConvF2INode::Identity(PhaseGVN* phase) {
179183
//------------------------------Ideal------------------------------------------
180184
// If converting to an int type, skip any rounding nodes
181185
Node *ConvF2INode::Ideal(PhaseGVN *phase, bool can_reshape) {
182-
if( in(1)->Opcode() == Op_RoundFloat )
183-
set_req(1,in(1)->in(1));
186+
if (in(1)->Opcode() == Op_RoundFloat) {
187+
set_req(1, in(1)->in(1));
188+
return this;
189+
}
184190
return NULL;
185191
}
186192

@@ -206,8 +212,10 @@ Node* ConvF2LNode::Identity(PhaseGVN* phase) {
206212
//------------------------------Ideal------------------------------------------
207213
// If converting to an int type, skip any rounding nodes
208214
Node *ConvF2LNode::Ideal(PhaseGVN *phase, bool can_reshape) {
209-
if( in(1)->Opcode() == Op_RoundFloat )
210-
set_req(1,in(1)->in(1));
215+
if (in(1)->Opcode() == Op_RoundFloat) {
216+
set_req(1, in(1)->in(1));
217+
return this;
218+
}
211219
return NULL;
212220
}
213221

0 commit comments

Comments
 (0)