src/share/vm/opto/loopopts.cpp

changeset 1976
6027dddc26c6
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
equal deleted inserted replaced
1975:d678e3277048 1976:6027dddc26c6
352 register_new_node( inv_scale, inv_scale_ctrl ); 352 register_new_node( inv_scale, inv_scale_ctrl );
353 Node *var_scale = new (C, 3) LShiftINode( add_var, scale ); 353 Node *var_scale = new (C, 3) LShiftINode( add_var, scale );
354 register_new_node( var_scale, n_ctrl ); 354 register_new_node( var_scale, n_ctrl );
355 Node *var_add = new (C, 3) AddINode( var_scale, inv_scale ); 355 Node *var_add = new (C, 3) AddINode( var_scale, inv_scale );
356 register_new_node( var_add, n_ctrl ); 356 register_new_node( var_add, n_ctrl );
357 _igvn.hash_delete( n ); 357 _igvn.replace_node( n, var_add );
358 _igvn.subsume_node( n, var_add );
359 return var_add; 358 return var_add;
360 } 359 }
361 360
362 // Replace (I+V) with (V+I) 361 // Replace (I+V) with (V+I)
363 if( n_op == Op_AddI || 362 if( n_op == Op_AddI ||
388 Node *add1 = new (C, 4) AddPNode( n->in(1), n->in(2)->in(2), n->in(3) ); 387 Node *add1 = new (C, 4) AddPNode( n->in(1), n->in(2)->in(2), n->in(3) );
389 // Stuff new AddP in the loop preheader 388 // Stuff new AddP in the loop preheader
390 register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) ); 389 register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) );
391 Node *add2 = new (C, 4) AddPNode( n->in(1), add1, n->in(2)->in(3) ); 390 Node *add2 = new (C, 4) AddPNode( n->in(1), add1, n->in(2)->in(3) );
392 register_new_node( add2, n_ctrl ); 391 register_new_node( add2, n_ctrl );
393 _igvn.hash_delete( n ); 392 _igvn.replace_node( n, add2 );
394 _igvn.subsume_node( n, add2 );
395 return add2; 393 return add2;
396 } 394 }
397 } 395 }
398 } 396 }
399 397
410 Node *add1 = new (C, 4) AddPNode( n->in(1), n->in(2), I ); 408 Node *add1 = new (C, 4) AddPNode( n->in(1), n->in(2), I );
411 // Stuff new AddP in the loop preheader 409 // Stuff new AddP in the loop preheader
412 register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) ); 410 register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) );
413 Node *add2 = new (C, 4) AddPNode( n->in(1), add1, V ); 411 Node *add2 = new (C, 4) AddPNode( n->in(1), add1, V );
414 register_new_node( add2, n_ctrl ); 412 register_new_node( add2, n_ctrl );
415 _igvn.hash_delete( n ); 413 _igvn.replace_node( n, add2 );
416 _igvn.subsume_node( n, add2 );
417 return add2; 414 return add2;
418 } 415 }
419 } 416 }
420 } 417 }
421 } 418 }
553 set_ctrl(inp, cmov_ctrl); 550 set_ctrl(inp, cmov_ctrl);
554 } 551 }
555 } 552 }
556 Node *cmov = CMoveNode::make( C, cmov_ctrl, iff->in(1), phi->in(1+flip), phi->in(2-flip), _igvn.type(phi) ); 553 Node *cmov = CMoveNode::make( C, cmov_ctrl, iff->in(1), phi->in(1+flip), phi->in(2-flip), _igvn.type(phi) );
557 register_new_node( cmov, cmov_ctrl ); 554 register_new_node( cmov, cmov_ctrl );
558 _igvn.hash_delete(phi); 555 _igvn.replace_node( phi, cmov );
559 _igvn.subsume_node( phi, cmov );
560 #ifndef PRODUCT 556 #ifndef PRODUCT
561 if( VerifyLoopOptimizations ) verify(); 557 if( VerifyLoopOptimizations ) verify();
562 #endif 558 #endif
563 } 559 }
564 560
640 Node *phi = split_thru_phi( n, n_blk, policy ); 636 Node *phi = split_thru_phi( n, n_blk, policy );
641 if( !phi ) return n; 637 if( !phi ) return n;
642 638
643 // Found a Phi to split thru! 639 // Found a Phi to split thru!
644 // Replace 'n' with the new phi 640 // Replace 'n' with the new phi
645 _igvn.hash_delete(n); 641 _igvn.replace_node( n, phi );
646 _igvn.subsume_node( n, phi );
647 // Moved a load around the loop, 'en-registering' something. 642 // Moved a load around the loop, 'en-registering' something.
648 if( n_blk->Opcode() == Op_Loop && n->is_Load() && 643 if( n_blk->Opcode() == Op_Loop && n->is_Load() &&
649 !phi->in(LoopNode::LoopBackControl)->is_Load() ) 644 !phi->in(LoopNode::LoopBackControl)->is_Load() )
650 C->set_major_progress(); 645 C->set_major_progress();
651 646
787 Node *phi = split_thru_phi( n, n_ctrl, policy ); 782 Node *phi = split_thru_phi( n, n_ctrl, policy );
788 if( !phi ) return; 783 if( !phi ) return;
789 784
790 // Found a Phi to split thru! 785 // Found a Phi to split thru!
791 // Replace 'n' with the new phi 786 // Replace 'n' with the new phi
792 _igvn.hash_delete(n); 787 _igvn.replace_node( n, phi );
793 _igvn.subsume_node( n, phi );
794 788
795 // Now split the bool up thru the phi 789 // Now split the bool up thru the phi
796 Node *bolphi = split_thru_phi( bol, n_ctrl, -1 ); 790 Node *bolphi = split_thru_phi( bol, n_ctrl, -1 );
797 _igvn.hash_delete(bol); 791 _igvn.replace_node( bol, bolphi );
798 _igvn.subsume_node( bol, bolphi );
799 assert( iff->in(1) == bolphi, "" ); 792 assert( iff->in(1) == bolphi, "" );
800 if( bolphi->Value(&_igvn)->singleton() ) 793 if( bolphi->Value(&_igvn)->singleton() )
801 return; 794 return;
802 795
803 // Conditional-move? Must split up now 796 // Conditional-move? Must split up now
804 if( !iff->is_If() ) { 797 if( !iff->is_If() ) {
805 Node *cmovphi = split_thru_phi( iff, n_ctrl, -1 ); 798 Node *cmovphi = split_thru_phi( iff, n_ctrl, -1 );
806 _igvn.hash_delete(iff); 799 _igvn.replace_node( iff, cmovphi );
807 _igvn.subsume_node( iff, cmovphi );
808 return; 800 return;
809 } 801 }
810 802
811 // Now split the IF 803 // Now split the IF
812 do_split_if( iff ); 804 do_split_if( iff );
948 // Check for Opaque2's who's loop has disappeared - who's input is in the 940 // Check for Opaque2's who's loop has disappeared - who's input is in the
949 // same loop nest as their output. Remove 'em, they are no longer useful. 941 // same loop nest as their output. Remove 'em, they are no longer useful.
950 if( n_op == Op_Opaque2 && 942 if( n_op == Op_Opaque2 &&
951 n->in(1) != NULL && 943 n->in(1) != NULL &&
952 get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) { 944 get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) {
953 _igvn.add_users_to_worklist(n); 945 _igvn.replace_node( n, n->in(1) );
954 _igvn.hash_delete(n);
955 _igvn.subsume_node( n, n->in(1) );
956 } 946 }
957 } 947 }
958 948
959 //------------------------------split_if_with_blocks--------------------------- 949 //------------------------------split_if_with_blocks---------------------------
960 // Check for aggressive application of 'split-if' optimization, 950 // Check for aggressive application of 'split-if' optimization,
1423 // in AddPNode from tripping (when we end up with different 1413 // in AddPNode from tripping (when we end up with different
1424 // base & derived Phis that will become the same after 1414 // base & derived Phis that will become the same after
1425 // IGVN does CSE). 1415 // IGVN does CSE).
1426 Node *hit = _igvn.hash_find_insert(use); 1416 Node *hit = _igvn.hash_find_insert(use);
1427 if( hit ) // Go ahead and re-hash for hits. 1417 if( hit ) // Go ahead and re-hash for hits.
1428 _igvn.subsume_node( use, hit ); 1418 _igvn.replace_node( use, hit );
1429 } 1419 }
1430 1420
1431 // If 'use' was in the loop-exit block, it now needs to be sunk 1421 // If 'use' was in the loop-exit block, it now needs to be sunk
1432 // below the post-loop merge point. 1422 // below the post-loop merge point.
1433 sink_use( use, prev ); 1423 sink_use( use, prev );

mercurial