20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "memory/allocation.inline.hpp"
27 #include "memory/resourceArea.hpp"
28 #include "opto/addnode.hpp"
29 #include "opto/castnode.hpp"
30 #include "opto/connode.hpp"
31 #include "opto/castnode.hpp"
32 #include "opto/divnode.hpp"
33 #include "opto/loopnode.hpp"
34 #include "opto/matcher.hpp"
35 #include "opto/mulnode.hpp"
36 #include "opto/movenode.hpp"
37 #include "opto/opaquenode.hpp"
38 #include "opto/rootnode.hpp"
39 #include "opto/subnode.hpp"
40
41 //=============================================================================
42 //------------------------------split_thru_phi---------------------------------
43 // Split Node 'n' through merge point if there is enough win.
44 Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *region, int policy ) {
45 if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::LONG) {
46 // ConvI2L may have type information on it which is unsafe to push up
47 // so disable this for now
48 return NULL;
49 }
50
51 // Splitting range check CastIIs through a loop induction Phi can
52 // cause new Phis to be created that are left unrelated to the loop
53 // induction Phi and prevent optimizations (vectorization)
54 if (n->Opcode() == Op_CastII && n->as_CastII()->has_range_check() &&
55 region->is_CountedLoop() && n->in(1) == region->as_CountedLoop()->phi()) {
56 return NULL;
57 }
58
59 // Value types should not be split through Phis because they cannot be merged
1341
1342 // Some institutional knowledge is needed here: 'x' is
1343 // yanked because if the optimizer runs GVN on it all the
1344 // cloned x's will common up and undo this optimization and
1345 // be forced back in the loop. This is annoying because it
1346 // makes +VerifyOpto report false-positives on progress. I
1347 // tried setting control edges on the x's to force them to
1348 // not combine, but the matching gets worried when it tries
1349 // to fold a StoreP and an AddP together (as part of an
1350 // address expression) and the AddP and StoreP have
1351 // different controls.
1352 if (!x->is_Load() && !x->is_DecodeNarrowPtr()) _igvn._worklist.yank(x);
1353 }
1354 _igvn.remove_dead_node(n);
1355 }
1356 }
1357 }
1358 }
1359
1360 try_move_store_after_loop(n);
1361
1362 // Check for Opaque2's who's loop has disappeared - who's input is in the
1363 // same loop nest as their output. Remove 'em, they are no longer useful.
1364 if( n_op == Op_Opaque2 &&
1365 n->in(1) != NULL &&
1366 get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) {
1367 _igvn.replace_node( n, n->in(1) );
1368 }
1369 }
1370
1371 //------------------------------split_if_with_blocks---------------------------
1372 // Check for aggressive application of 'split-if' optimization,
1373 // using basic block level info.
1374 void PhaseIdealLoop::split_if_with_blocks( VectorSet &visited, Node_Stack &nstack ) {
1375 Node *n = C->root();
1376 visited.set(n->_idx); // first, mark node as visited
1377 // Do pre-visit work for root
1378 n = split_if_with_blocks_pre( n );
1379 uint cnt = n->outcnt();
1380 uint i = 0;
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "memory/allocation.inline.hpp"
27 #include "memory/resourceArea.hpp"
28 #include "opto/addnode.hpp"
29 #include "opto/castnode.hpp"
30 #include "opto/connode.hpp"
31 #include "opto/castnode.hpp"
32 #include "opto/divnode.hpp"
33 #include "opto/loopnode.hpp"
34 #include "opto/matcher.hpp"
35 #include "opto/mulnode.hpp"
36 #include "opto/movenode.hpp"
37 #include "opto/opaquenode.hpp"
38 #include "opto/rootnode.hpp"
39 #include "opto/subnode.hpp"
40 #include "opto/valuetypenode.hpp"
41
42 //=============================================================================
43 //------------------------------split_thru_phi---------------------------------
44 // Split Node 'n' through merge point if there is enough win.
45 Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *region, int policy ) {
46 if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::LONG) {
47 // ConvI2L may have type information on it which is unsafe to push up
48 // so disable this for now
49 return NULL;
50 }
51
52 // Splitting range check CastIIs through a loop induction Phi can
53 // cause new Phis to be created that are left unrelated to the loop
54 // induction Phi and prevent optimizations (vectorization)
55 if (n->Opcode() == Op_CastII && n->as_CastII()->has_range_check() &&
56 region->is_CountedLoop() && n->in(1) == region->as_CountedLoop()->phi()) {
57 return NULL;
58 }
59
60 // Value types should not be split through Phis because they cannot be merged
1342
1343 // Some institutional knowledge is needed here: 'x' is
1344 // yanked because if the optimizer runs GVN on it all the
1345 // cloned x's will common up and undo this optimization and
1346 // be forced back in the loop. This is annoying because it
1347 // makes +VerifyOpto report false-positives on progress. I
1348 // tried setting control edges on the x's to force them to
1349 // not combine, but the matching gets worried when it tries
1350 // to fold a StoreP and an AddP together (as part of an
1351 // address expression) and the AddP and StoreP have
1352 // different controls.
1353 if (!x->is_Load() && !x->is_DecodeNarrowPtr()) _igvn._worklist.yank(x);
1354 }
1355 _igvn.remove_dead_node(n);
1356 }
1357 }
1358 }
1359 }
1360
1361 try_move_store_after_loop(n);
1362
1363 // Remove multiple allocations of the same value type
1364 if (n->is_ValueType() && EliminateAllocations) {
1365 n->as_ValueType()->remove_redundant_allocations(&_igvn, this);
1366 }
1367
1368 // Check for Opaque2's who's loop has disappeared - who's input is in the
1369 // same loop nest as their output. Remove 'em, they are no longer useful.
1370 if( n_op == Op_Opaque2 &&
1371 n->in(1) != NULL &&
1372 get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) {
1373 _igvn.replace_node( n, n->in(1) );
1374 }
1375 }
1376
1377 //------------------------------split_if_with_blocks---------------------------
1378 // Check for aggressive application of 'split-if' optimization,
1379 // using basic block level info.
1380 void PhaseIdealLoop::split_if_with_blocks( VectorSet &visited, Node_Stack &nstack ) {
1381 Node *n = C->root();
1382 visited.set(n->_idx); // first, mark node as visited
1383 // Do pre-visit work for root
1384 n = split_if_with_blocks_pre( n );
1385 uint cnt = n->outcnt();
1386 uint i = 0;
|