Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/cfgnode.cpp @ 3845:c96c3eb1efae
7068051: SIGSEGV in PhaseIdealLoop::build_loop_late_post
Summary: Removed predicate cloning from loop peeling optimization and from split fall-in paths.
Reviewed-by: never
author | kvn |
---|---|
date | Fri, 29 Jul 2011 09:16:29 -0700 |
parents | b55f5bd7ec66 |
children | 8c57262447d3 |
comparison
equal
deleted
inserted
replaced
3844:ce3e1d4dc416 | 3845:c96c3eb1efae |
---|---|
1347 //------------------------------split_once------------------------------------- | 1347 //------------------------------split_once------------------------------------- |
1348 // Helper for split_flow_path | 1348 // Helper for split_flow_path |
1349 static void split_once(PhaseIterGVN *igvn, Node *phi, Node *val, Node *n, Node *newn) { | 1349 static void split_once(PhaseIterGVN *igvn, Node *phi, Node *val, Node *n, Node *newn) { |
1350 igvn->hash_delete(n); // Remove from hash before hacking edges | 1350 igvn->hash_delete(n); // Remove from hash before hacking edges |
1351 | 1351 |
1352 Node* predicate_proj = NULL; | |
1353 uint j = 1; | 1352 uint j = 1; |
1354 for (uint i = phi->req()-1; i > 0; i--) { | 1353 for (uint i = phi->req()-1; i > 0; i--) { |
1355 if (phi->in(i) == val) { // Found a path with val? | 1354 if (phi->in(i) == val) { // Found a path with val? |
1356 if (n->is_Region()) { | |
1357 Node* proj = PhaseIdealLoop::find_predicate(n->in(i)); | |
1358 if (proj != NULL) { | |
1359 assert(predicate_proj == NULL, "only one predicate entry expected"); | |
1360 predicate_proj = proj; | |
1361 } | |
1362 } | |
1363 // Add to NEW Region/Phi, no DU info | 1355 // Add to NEW Region/Phi, no DU info |
1364 newn->set_req( j++, n->in(i) ); | 1356 newn->set_req( j++, n->in(i) ); |
1365 // Remove from OLD Region/Phi | 1357 // Remove from OLD Region/Phi |
1366 n->del_req(i); | 1358 n->del_req(i); |
1367 } | 1359 } |
1368 } | 1360 } |
1369 | 1361 |
1370 // Register the new node but do not transform it. Cannot transform until the | 1362 // Register the new node but do not transform it. Cannot transform until the |
1371 // entire Region/Phi conglomerate has been hacked as a single huge transform. | 1363 // entire Region/Phi conglomerate has been hacked as a single huge transform. |
1372 igvn->register_new_node_with_optimizer( newn ); | 1364 igvn->register_new_node_with_optimizer( newn ); |
1373 | |
1374 // Clone loop predicates | |
1375 if (predicate_proj != NULL) { | |
1376 newn = igvn->clone_loop_predicates(predicate_proj, newn, !n->is_CountedLoop()); | |
1377 } | |
1378 | 1365 |
1379 // Now I can point to the new node. | 1366 // Now I can point to the new node. |
1380 n->add_req(newn); | 1367 n->add_req(newn); |
1381 igvn->_worklist.push(n); | 1368 igvn->_worklist.push(n); |
1382 } | 1369 } |
1402 if( i >= phi->req() ) // Only split for constants | 1389 if( i >= phi->req() ) // Only split for constants |
1403 return NULL; | 1390 return NULL; |
1404 | 1391 |
1405 Node *val = phi->in(i); // Constant to split for | 1392 Node *val = phi->in(i); // Constant to split for |
1406 uint hit = 0; // Number of times it occurs | 1393 uint hit = 0; // Number of times it occurs |
1394 Node *r = phi->region(); | |
1407 | 1395 |
1408 for( ; i < phi->req(); i++ ){ // Count occurrences of constant | 1396 for( ; i < phi->req(); i++ ){ // Count occurrences of constant |
1409 Node *n = phi->in(i); | 1397 Node *n = phi->in(i); |
1410 if( !n ) return NULL; | 1398 if( !n ) return NULL; |
1411 if( phase->type(n) == Type::TOP ) return NULL; | 1399 if( phase->type(n) == Type::TOP ) return NULL; |
1412 if( phi->in(i) == val ) | 1400 if( phi->in(i) == val ) { |
1413 hit++; | 1401 hit++; |
1402 if (PhaseIdealLoop::find_predicate(r->in(i)) != NULL) { | |
1403 return NULL; // don't split loop entry path | |
1404 } | |
1405 } | |
1414 } | 1406 } |
1415 | 1407 |
1416 if( hit <= 1 || // Make sure we find 2 or more | 1408 if( hit <= 1 || // Make sure we find 2 or more |
1417 hit == phi->req()-1 ) // and not ALL the same value | 1409 hit == phi->req()-1 ) // and not ALL the same value |
1418 return NULL; | 1410 return NULL; |
1419 | 1411 |
1420 // Now start splitting out the flow paths that merge the same value. | 1412 // Now start splitting out the flow paths that merge the same value. |
1421 // Split first the RegionNode. | 1413 // Split first the RegionNode. |
1422 PhaseIterGVN *igvn = phase->is_IterGVN(); | 1414 PhaseIterGVN *igvn = phase->is_IterGVN(); |
1423 Node *r = phi->region(); | |
1424 RegionNode *newr = new (phase->C, hit+1) RegionNode(hit+1); | 1415 RegionNode *newr = new (phase->C, hit+1) RegionNode(hit+1); |
1425 split_once(igvn, phi, val, r, newr); | 1416 split_once(igvn, phi, val, r, newr); |
1426 | 1417 |
1427 // Now split all other Phis than this one | 1418 // Now split all other Phis than this one |
1428 for (DUIterator_Fast kmax, k = r->fast_outs(kmax); k < kmax; k++) { | 1419 for (DUIterator_Fast kmax, k = r->fast_outs(kmax); k < kmax; k++) { |