79 // See that the merge point contains some constants |
79 // See that the merge point contains some constants |
80 Node *con1=NULL; |
80 Node *con1=NULL; |
81 uint i4; |
81 uint i4; |
82 for( i4 = 1; i4 < phi->req(); i4++ ) { |
82 for( i4 = 1; i4 < phi->req(); i4++ ) { |
83 con1 = phi->in(i4); |
83 con1 = phi->in(i4); |
84 if( !con1 ) return NULL; // Do not optimize partially collaped merges |
84 if( !con1 ) return NULL; // Do not optimize partially collapsed merges |
85 if( con1->is_Con() ) break; // Found a constant |
85 if( con1->is_Con() ) break; // Found a constant |
86 // Also allow null-vs-not-null checks |
86 // Also allow null-vs-not-null checks |
87 const TypePtr *tp = igvn->type(con1)->isa_ptr(); |
87 const TypePtr *tp = igvn->type(con1)->isa_ptr(); |
88 if( tp && tp->_ptr == TypePtr::NotNull ) |
88 if( tp && tp->_ptr == TypePtr::NotNull ) |
89 break; |
89 break; |
202 // bool bool_c bool_x |
202 // bool bool_c bool_x |
203 // if if_c if_x |
203 // if if_c if_x |
204 // T F T F T F |
204 // T F T F T F |
205 // ..s.. ..t .. ..s.. ..t.. ..s.. ..t.. |
205 // ..s.. ..t .. ..s.. ..t.. ..s.. ..t.. |
206 // |
206 // |
207 // Split the paths coming into the merge point into 2 seperate groups of |
207 // Split the paths coming into the merge point into 2 separate groups of |
208 // merges. On the left will be all the paths feeding constants into the |
208 // merges. On the left will be all the paths feeding constants into the |
209 // Cmp's Phi. On the right will be the remaining paths. The Cmp's Phi |
209 // Cmp's Phi. On the right will be the remaining paths. The Cmp's Phi |
210 // will fold up into a constant; this will let the Cmp fold up as well as |
210 // will fold up into a constant; this will let the Cmp fold up as well as |
211 // all the control flow. Below the original IF we have 2 control |
211 // all the control flow. Below the original IF we have 2 control |
212 // dependent regions, 's' and 't'. Now we will merge the two paths |
212 // dependent regions, 's' and 't'. Now we will merge the two paths |
234 phi_x ->init_req( i_x++, phi->in(i) ); |
234 phi_x ->init_req( i_x++, phi->in(i) ); |
235 } |
235 } |
236 } |
236 } |
237 |
237 |
238 // Register the new RegionNodes but do not transform them. Cannot |
238 // Register the new RegionNodes but do not transform them. Cannot |
239 // transform until the entire Region/Phi conglerate has been hacked |
239 // transform until the entire Region/Phi conglomerate has been hacked |
240 // as a single huge transform. |
240 // as a single huge transform. |
241 igvn->register_new_node_with_optimizer( region_c ); |
241 igvn->register_new_node_with_optimizer( region_c ); |
242 igvn->register_new_node_with_optimizer( region_x ); |
242 igvn->register_new_node_with_optimizer( region_x ); |
243 phi_x = phase->transform( phi_x ); |
243 phi_x = phase->transform( phi_x ); |
244 // Prevent the untimely death of phi_x. Currently he has no uses. He is |
244 // Prevent the untimely death of phi_x. Currently he has no uses. He is |
597 return NULL; |
597 return NULL; |
598 } |
598 } |
599 |
599 |
600 //------------------------------fold_compares---------------------------- |
600 //------------------------------fold_compares---------------------------- |
601 // See if a pair of CmpIs can be converted into a CmpU. In some cases |
601 // See if a pair of CmpIs can be converted into a CmpU. In some cases |
602 // the direction of this if is determined by the preciding if so it |
602 // the direction of this if is determined by the preceding if so it |
603 // can be eliminate entirely. Given an if testing (CmpI n c) check |
603 // can be eliminate entirely. Given an if testing (CmpI n c) check |
604 // for an immediately control dependent if that is testing (CmpI n c2) |
604 // for an immediately control dependent if that is testing (CmpI n c2) |
605 // and has one projection leading to this if and the other projection |
605 // and has one projection leading to this if and the other projection |
606 // leading to a region that merges one of this ifs control |
606 // leading to a region that merges one of this ifs control |
607 // projections. |
607 // projections. |
809 Node *first_prev_dom = NULL; |
809 Node *first_prev_dom = NULL; |
810 |
810 |
811 // Try to remove extra range checks. All 'up_one_dom' gives up at merges |
811 // Try to remove extra range checks. All 'up_one_dom' gives up at merges |
812 // so all checks we inspect post-dominate the top-most check we find. |
812 // so all checks we inspect post-dominate the top-most check we find. |
813 // If we are going to fail the current check and we reach the top check |
813 // If we are going to fail the current check and we reach the top check |
814 // then we are guarenteed to fail, so just start interpreting there. |
814 // then we are guaranteed to fail, so just start interpreting there. |
815 // We 'expand' the top 2 range checks to include all post-dominating |
815 // We 'expand' the top 2 range checks to include all post-dominating |
816 // checks. |
816 // checks. |
817 |
817 |
818 // The top 2 range checks seen |
818 // The top 2 range checks seen |
819 Node *prev_chk1 = NULL; |
819 Node *prev_chk1 = NULL; |