222 if (pop == Op_IfTrue)
223 pop = Op_IfFalse;
224 else
225 pop = Op_IfTrue;
226 }
227 // 'con' is set to true or false to kill the dominated test.
228 Node *con = _igvn.makecon(pop == Op_IfTrue ? TypeInt::ONE : TypeInt::ZERO);
229 set_ctrl(con, C->root()); // Constant gets a new use
230 // Hack the dominated test
231 _igvn.replace_input_of(iff, 1, con);
232
233 // If I dont have a reachable TRUE and FALSE path following the IfNode then
234 // I can assume this path reaches an infinite loop. In this case it's not
235 // important to optimize the data Nodes - either the whole compilation will
236 // be tossed or this path (and all data Nodes) will go dead.
237 if (iff->outcnt() != 2) return;
238
239 // Make control-dependent data Nodes on the live path (path that will remain
240 // once the dominated IF is removed) become control-dependent on the
241 // dominating projection.
242 Node* dp = iff->as_If()->proj_out(pop == Op_IfTrue);
243
244 // Loop predicates may have depending checks which should not
245 // be skipped. For example, range check predicate has two checks
246 // for lower and upper bounds.
247 if (dp == NULL)
248 return;
249
250 ProjNode* dp_proj = dp->as_Proj();
251 ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp_proj->_con)->as_Proj();
252 if (exclude_loop_predicate &&
253 (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) != NULL ||
254 unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_range_check) != NULL)) {
255 // If this is a range check (IfNode::is_range_check), do not
256 // reorder because Compile::allow_range_check_smearing might have
257 // changed the check.
258 return; // Let IGVN transformation change control dependence.
259 }
260
261 IdealLoopTree *old_loop = get_loop(dp);
262
1939 if( !old->is_CFG() ) continue;
1940
1941 // Copy uses to a worklist, so I can munge the def-use info
1942 // with impunity.
1943 for (DUIterator_Fast jmax, j = old->fast_outs(jmax); j < jmax; j++)
1944 worklist.push(old->fast_out(j));
1945
1946 while( worklist.size() ) { // Visit all uses
1947 Node *use = worklist.pop();
1948 if (!has_node(use)) continue; // Ignore dead nodes
1949 IdealLoopTree *use_loop = get_loop( has_ctrl(use) ? get_ctrl(use) : use );
1950 if( !loop->is_member( use_loop ) && use->is_CFG() ) {
1951 // Both OLD and USE are CFG nodes here.
1952 assert( use->is_Proj(), "" );
1953 Node* nnn = old_new[old->_idx];
1954
1955 Node* newuse = NULL;
1956 if (head->is_strip_mined() && mode != IgnoreStripMined) {
1957 CountedLoopNode* cl = head->as_CountedLoop();
1958 CountedLoopEndNode* cle = cl->loopexit();
1959 Node* cle_out = cle->proj_out(false);
1960 if (use == cle_out) {
1961 IfNode* le = cl->outer_loop_end();
1962 use = le->proj_out(false);
1963 use_loop = get_loop(use);
1964 if (mode == CloneIncludesStripMined) {
1965 nnn = old_new[le->_idx];
1966 } else {
1967 newuse = old_new[cle_out->_idx];
1968 }
1969 }
1970 }
1971 if (newuse == NULL) {
1972 newuse = use->clone();
1973 }
1974
1975 // Clone the loop exit control projection
1976 if (C->do_vector_loop()) {
1977 cm.verify_insert_and_clone(use, newuse, cm.clone_idx());
1978 }
1979 newuse->set_req(0,nnn);
|
222 if (pop == Op_IfTrue)
223 pop = Op_IfFalse;
224 else
225 pop = Op_IfTrue;
226 }
227 // 'con' is set to true or false to kill the dominated test.
228 Node *con = _igvn.makecon(pop == Op_IfTrue ? TypeInt::ONE : TypeInt::ZERO);
229 set_ctrl(con, C->root()); // Constant gets a new use
230 // Hack the dominated test
231 _igvn.replace_input_of(iff, 1, con);
232
233 // If I dont have a reachable TRUE and FALSE path following the IfNode then
234 // I can assume this path reaches an infinite loop. In this case it's not
235 // important to optimize the data Nodes - either the whole compilation will
236 // be tossed or this path (and all data Nodes) will go dead.
237 if (iff->outcnt() != 2) return;
238
239 // Make control-dependent data Nodes on the live path (path that will remain
240 // once the dominated IF is removed) become control-dependent on the
241 // dominating projection.
242 Node* dp = iff->as_If()->proj_out_or_null(pop == Op_IfTrue);
243
244 // Loop predicates may have depending checks which should not
245 // be skipped. For example, range check predicate has two checks
246 // for lower and upper bounds.
247 if (dp == NULL)
248 return;
249
250 ProjNode* dp_proj = dp->as_Proj();
251 ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp_proj->_con)->as_Proj();
252 if (exclude_loop_predicate &&
253 (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) != NULL ||
254 unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_range_check) != NULL)) {
255 // If this is a range check (IfNode::is_range_check), do not
256 // reorder because Compile::allow_range_check_smearing might have
257 // changed the check.
258 return; // Let IGVN transformation change control dependence.
259 }
260
261 IdealLoopTree *old_loop = get_loop(dp);
262
1939 if( !old->is_CFG() ) continue;
1940
1941 // Copy uses to a worklist, so I can munge the def-use info
1942 // with impunity.
1943 for (DUIterator_Fast jmax, j = old->fast_outs(jmax); j < jmax; j++)
1944 worklist.push(old->fast_out(j));
1945
1946 while( worklist.size() ) { // Visit all uses
1947 Node *use = worklist.pop();
1948 if (!has_node(use)) continue; // Ignore dead nodes
1949 IdealLoopTree *use_loop = get_loop( has_ctrl(use) ? get_ctrl(use) : use );
1950 if( !loop->is_member( use_loop ) && use->is_CFG() ) {
1951 // Both OLD and USE are CFG nodes here.
1952 assert( use->is_Proj(), "" );
1953 Node* nnn = old_new[old->_idx];
1954
1955 Node* newuse = NULL;
1956 if (head->is_strip_mined() && mode != IgnoreStripMined) {
1957 CountedLoopNode* cl = head->as_CountedLoop();
1958 CountedLoopEndNode* cle = cl->loopexit();
1959 Node* cle_out = cle->proj_out_or_null(false);
1960 if (use == cle_out) {
1961 IfNode* le = cl->outer_loop_end();
1962 use = le->proj_out(false);
1963 use_loop = get_loop(use);
1964 if (mode == CloneIncludesStripMined) {
1965 nnn = old_new[le->_idx];
1966 } else {
1967 newuse = old_new[cle_out->_idx];
1968 }
1969 }
1970 }
1971 if (newuse == NULL) {
1972 newuse = use->clone();
1973 }
1974
1975 // Clone the loop exit control projection
1976 if (C->do_vector_loop()) {
1977 cm.verify_insert_and_clone(use, newuse, cm.clone_idx());
1978 }
1979 newuse->set_req(0,nnn);
|