Thu, 28 Feb 2008 15:40:09 -0800
6667573: Use set_req_X() in AddPNode::Ideal() for Iterative GVN
Summary: set_req_X() puts dependent nodes on IGVN worklist which allows to improve graph and gives more opportunities for EA scalar replacement.
Reviewed-by: jrose, never
src/share/vm/opto/addnode.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/opto/addnode.cpp Thu Feb 28 10:45:15 2008 -0800 1.2 +++ b/src/share/vm/opto/addnode.cpp Thu Feb 28 15:40:09 2008 -0800 1.3 @@ -505,15 +505,25 @@ 1.4 const Type *temp_t2 = phase->type( in(Offset) ); 1.5 if( temp_t2 == Type::TOP ) return NULL; 1.6 const TypeX *t2 = temp_t2->is_intptr_t(); 1.7 + Node* address; 1.8 + Node* offset; 1.9 if( t2->is_con() ) { 1.10 // The Add of the flattened expression 1.11 - set_req(Address, addp->in(Address)); 1.12 - set_req(Offset , phase->MakeConX(t2->get_con() + t12->get_con())); 1.13 - return this; // Made progress 1.14 + address = addp->in(Address); 1.15 + offset = phase->MakeConX(t2->get_con() + t12->get_con()); 1.16 + } else { 1.17 + // Else move the constant to the right. ((A+con)+B) into ((A+B)+con) 1.18 + address = phase->transform(new (phase->C, 4) AddPNode(in(Base),addp->in(Address),in(Offset))); 1.19 + offset = addp->in(Offset); 1.20 } 1.21 - // Else move the constant to the right. ((A+con)+B) into ((A+B)+con) 1.22 - set_req(Address, phase->transform(new (phase->C, 4) AddPNode(in(Base),addp->in(Address),in(Offset)))); 1.23 - set_req(Offset , addp->in(Offset)); 1.24 + PhaseIterGVN *igvn = phase->is_IterGVN(); 1.25 + if( igvn ) { 1.26 + set_req_X(Address,address,igvn); 1.27 + set_req_X(Offset,offset,igvn); 1.28 + } else { 1.29 + set_req(Address,address); 1.30 + set_req(Offset,offset); 1.31 + } 1.32 return this; 1.33 } 1.34 }