src/share/vm/opto/loopTransform.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7045693 Sdiff src/share/vm/opto

src/share/vm/opto/loopTransform.cpp

Print this page




1275             old_limit = bol->in(1)->in(1);
1276             // Adjust previous adjusted limit.
1277             adj_limit = limit->in(CMoveNode::IfFalse);
1278             adj_limit = new (C, 3) SubINode(adj_limit, stride);
1279           } else {
1280             old_limit = limit;
1281             adj_limit = new (C, 3) SubINode(limit, stride);
1282           }
1283           assert(old_limit != NULL && adj_limit != NULL, "");
1284           register_new_node( adj_limit, ctrl ); // adjust amount
1285           Node* adj_cmp = new (C, 3) CmpINode(old_limit, adj_limit);
1286           register_new_node( adj_cmp, ctrl );
1287           Node* adj_bool = new (C, 2) BoolNode(adj_cmp, bt);
1288           register_new_node( adj_bool, ctrl );
1289           new_limit = new (C, 4) CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT);
1290         }
1291         register_new_node(new_limit, ctrl);
1292       }
1293       assert(new_limit != NULL, "");
1294       // Replace in loop test.



1295       _igvn.hash_delete(cmp);
1296       cmp->set_req(2, new_limit);
1297 











1298       // Step 3: Find the min-trip test guaranteed before a 'main' loop.
1299       // Make it a 1-trip test (means at least 2 trips).
1300 
1301       // Guard test uses an 'opaque' node which is not shared.  Hence I
1302       // can edit it's inputs directly.  Hammer in the new limit for the
1303       // minimum-trip guard.
1304       assert(opaq->outcnt() == 1, "");
1305       _igvn.hash_delete(opaq);
1306       opaq->set_req(1, new_limit);
1307     }
1308 
1309     // Adjust max trip count. The trip count is intentionally rounded
1310     // down here (e.g. 15-> 7-> 3-> 1) because if we unwittingly over-unroll,
1311     // the main, unrolled, part of the loop will never execute as it is protected
1312     // by the min-trip test.  See bug 4834191 for a case where we over-unrolled
1313     // and later determined that part of the unrolled loop was dead.
1314     loop_head->set_trip_count(old_trip_count / 2);
1315 
1316     // Double the count of original iterations in the unrolled loop body.
1317     loop_head->double_unrolled_count();




1275             old_limit = bol->in(1)->in(1);
1276             // Adjust previous adjusted limit.
1277             adj_limit = limit->in(CMoveNode::IfFalse);
1278             adj_limit = new (C, 3) SubINode(adj_limit, stride);
1279           } else {
1280             old_limit = limit;
1281             adj_limit = new (C, 3) SubINode(limit, stride);
1282           }
1283           assert(old_limit != NULL && adj_limit != NULL, "");
1284           register_new_node( adj_limit, ctrl ); // adjust amount
1285           Node* adj_cmp = new (C, 3) CmpINode(old_limit, adj_limit);
1286           register_new_node( adj_cmp, ctrl );
1287           Node* adj_bool = new (C, 2) BoolNode(adj_cmp, bt);
1288           register_new_node( adj_bool, ctrl );
1289           new_limit = new (C, 4) CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT);
1290         }
1291         register_new_node(new_limit, ctrl);
1292       }
1293       assert(new_limit != NULL, "");
1294       // Replace in loop test.
1295       assert(loop_end->in(1)->in(1) == cmp, "sanity");
1296       if (cmp->outcnt() == 1 && loop_end->in(1)->outcnt() == 1) {
1297         // Don't need to create new test since only one user.
1298         _igvn.hash_delete(cmp);
1299         cmp->set_req(2, new_limit);
1300       } else {
1301         // Create new test since it is shared.
1302         Node* ctrl2 = loop_end->in(0);
1303         Node* cmp2  = cmp->clone();
1304         cmp2->set_req(2, new_limit);
1305         register_new_node(cmp2, ctrl2);
1306         Node* bol2 = loop_end->in(1)->clone();
1307         bol2->set_req(1, cmp2);
1308         register_new_node(bol2, ctrl2);
1309         _igvn.hash_delete(loop_end);
1310         loop_end->set_req(1, bol2);
1311       }
1312       // Step 3: Find the min-trip test guaranteed before a 'main' loop.
1313       // Make it a 1-trip test (means at least 2 trips).
1314 
1315       // Guard test uses an 'opaque' node which is not shared.  Hence I
1316       // can edit it's inputs directly.  Hammer in the new limit for the
1317       // minimum-trip guard.
1318       assert(opaq->outcnt() == 1, "");
1319       _igvn.hash_delete(opaq);
1320       opaq->set_req(1, new_limit);
1321     }
1322 
1323     // Adjust max trip count. The trip count is intentionally rounded
1324     // down here (e.g. 15-> 7-> 3-> 1) because if we unwittingly over-unroll,
1325     // the main, unrolled, part of the loop will never execute as it is protected
1326     // by the min-trip test.  See bug 4834191 for a case where we over-unrolled
1327     // and later determined that part of the unrolled loop was dead.
1328     loop_head->set_trip_count(old_trip_count / 2);
1329 
1330     // Double the count of original iterations in the unrolled loop body.
1331     loop_head->double_unrolled_count();


src/share/vm/opto/loopTransform.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File