< prev index next >

src/hotspot/share/opto/loopUnswitch.cpp

Print this page




 121   assert(unswitch_iff != NULL, "should be at least one");
 122 
 123 #ifndef PRODUCT
 124   if (TraceLoopOpts) {
 125     tty->print("Unswitch   %d ", head->unswitch_count()+1);
 126     loop->dump_head();
 127   }
 128 #endif
 129 
 130   // Need to revert back to normal loop
 131   if (head->is_CountedLoop() && !head->as_CountedLoop()->is_normal_loop()) {
 132     head->as_CountedLoop()->set_normal_loop();
 133   }
 134 
 135   ProjNode* proj_true = create_slow_version_of_loop(loop, old_new, unswitch_iff->Opcode(), CloneIncludesStripMined);
 136 
 137 #ifdef ASSERT
 138   Node* uniqc = proj_true->unique_ctrl_out();
 139   Node* entry = head->skip_strip_mined()->in(LoopNode::EntryControl);
 140   Node* predicate = find_predicate(entry);



 141   if (predicate != NULL && UseLoopPredicate) {
 142     // We may have two predicates, find first.
 143     entry = find_predicate(entry->in(0)->in(0));







 144     if (entry != NULL) predicate = entry;
 145   }
 146   if (predicate != NULL) predicate = predicate->in(0);
 147   assert(proj_true->is_IfTrue() &&
 148          (predicate == NULL && uniqc == head && !head->is_strip_mined() ||
 149           predicate == NULL && uniqc == head->in(LoopNode::EntryControl) && head->is_strip_mined() ||
 150           predicate != NULL && uniqc == predicate), "by construction");
 151 #endif
 152   // Increment unswitch count
 153   LoopNode* head_clone = old_new[head->_idx]->as_Loop();
 154   int nct = head->unswitch_count() + 1;
 155   head->set_unswitch_count(nct);
 156   head_clone->set_unswitch_count(nct);
 157 
 158   // Add test to new "if" outside of loop
 159   IfNode* invar_iff   = proj_true->in(0)->as_If();
 160   Node* invar_iff_c   = invar_iff->in(0);
 161   BoolNode* bol       = unswitch_iff->in(1)->as_Bool();
 162   invar_iff->set_req(1, bol);
 163   invar_iff->_prob    = unswitch_iff->_prob;




 121   assert(unswitch_iff != NULL, "should be at least one");
 122 
 123 #ifndef PRODUCT
 124   if (TraceLoopOpts) {
 125     tty->print("Unswitch   %d ", head->unswitch_count()+1);
 126     loop->dump_head();
 127   }
 128 #endif
 129 
 130   // Need to revert back to normal loop
 131   if (head->is_CountedLoop() && !head->as_CountedLoop()->is_normal_loop()) {
 132     head->as_CountedLoop()->set_normal_loop();
 133   }
 134 
 135   ProjNode* proj_true = create_slow_version_of_loop(loop, old_new, unswitch_iff->Opcode(), CloneIncludesStripMined);
 136 
 137 #ifdef ASSERT
 138   Node* uniqc = proj_true->unique_ctrl_out();
 139   Node* entry = head->skip_strip_mined()->in(LoopNode::EntryControl);
 140   Node* predicate = find_predicate(entry);
 141   if (predicate != NULL) {
 142     entry = skip_loop_predicates(entry);
 143   }
 144   if (predicate != NULL && UseLoopPredicate) {
 145     // We may have two predicates, find first.
 146     Node* n = find_predicate(entry);
 147     if (n != NULL) {
 148       predicate = n;
 149       entry = skip_loop_predicates(entry);
 150     }
 151   }
 152   if (predicate != NULL && UseProfiledLoopPredicate) {
 153     entry = find_predicate(entry);
 154     if (entry != NULL) predicate = entry;
 155   }
 156   if (predicate != NULL) predicate = predicate->in(0);
 157   assert(proj_true->is_IfTrue() &&
 158          (predicate == NULL && uniqc == head && !head->is_strip_mined() ||
 159           predicate == NULL && uniqc == head->in(LoopNode::EntryControl) && head->is_strip_mined() ||
 160           predicate != NULL && uniqc == predicate), "by construction");
 161 #endif
 162   // Increment unswitch count
 163   LoopNode* head_clone = old_new[head->_idx]->as_Loop();
 164   int nct = head->unswitch_count() + 1;
 165   head->set_unswitch_count(nct);
 166   head_clone->set_unswitch_count(nct);
 167 
 168   // Add test to new "if" outside of loop
 169   IfNode* invar_iff   = proj_true->in(0)->as_If();
 170   Node* invar_iff_c   = invar_iff->in(0);
 171   BoolNode* bol       = unswitch_iff->in(1)->as_Bool();
 172   invar_iff->set_req(1, bol);
 173   invar_iff->_prob    = unswitch_iff->_prob;


< prev index next >