< prev index next >

src/share/vm/opto/loopPredicate.cpp

Print this page

        

*** 90,100 **** // We will create a region to guard the uct call if there is no one there. // The true projecttion (if_cont) of the new_iff is returned. // This code is also used to clone predicates to cloned loops. ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry, Deoptimization::DeoptReason reason, ! int opcode) { assert(cont_proj->is_uncommon_trap_if_pattern(reason), "must be a uct if pattern!"); IfNode* iff = cont_proj->in(0)->as_If(); ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con); Node *rgn = uncommon_proj->unique_ctrl_out(); --- 90,100 ---- // We will create a region to guard the uct call if there is no one there. // The true projecttion (if_cont) of the new_iff is returned. // This code is also used to clone predicates to cloned loops. ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry, Deoptimization::DeoptReason reason, ! Opcodes opcode) { assert(cont_proj->is_uncommon_trap_if_pattern(reason), "must be a uct if pattern!"); IfNode* iff = cont_proj->in(0)->as_If(); ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con); Node *rgn = uncommon_proj->unique_ctrl_out();
*** 133,146 **** entry = new_entry; } // Create new_iff IdealLoopTree* lp = get_loop(entry); IfNode* new_iff = NULL; ! if (opcode == Op_If) { new_iff = new IfNode(entry, iff->in(1), iff->_prob, iff->_fcnt); } else { ! assert(opcode == Op_RangeCheck, "no other if variant here"); new_iff = new RangeCheckNode(entry, iff->in(1), iff->_prob, iff->_fcnt); } register_control(new_iff, lp, entry); Node *if_cont = new IfTrueNode(new_iff); Node *if_uct = new IfFalseNode(new_iff); --- 133,146 ---- entry = new_entry; } // Create new_iff IdealLoopTree* lp = get_loop(entry); IfNode* new_iff = NULL; ! if (opcode == Opcodes::Op_If) { new_iff = new IfNode(entry, iff->in(1), iff->_prob, iff->_fcnt); } else { ! assert(opcode == Opcodes::Op_RangeCheck, "no other if variant here"); new_iff = new RangeCheckNode(entry, iff->in(1), iff->_prob, iff->_fcnt); } register_control(new_iff, lp, entry); Node *if_cont = new IfTrueNode(new_iff); Node *if_uct = new IfFalseNode(new_iff);
*** 188,198 **** //------------------------------create_new_if_for_predicate------------------------ // Create a new if below new_entry for the predicate to be cloned (IGVN optimization) ProjNode* PhaseIterGVN::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry, Deoptimization::DeoptReason reason, ! int opcode) { assert(new_entry != 0, "only used for clone predicate"); assert(cont_proj->is_uncommon_trap_if_pattern(reason), "must be a uct if pattern!"); IfNode* iff = cont_proj->in(0)->as_If(); ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con); --- 188,198 ---- //------------------------------create_new_if_for_predicate------------------------ // Create a new if below new_entry for the predicate to be cloned (IGVN optimization) ProjNode* PhaseIterGVN::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry, Deoptimization::DeoptReason reason, ! Opcodes opcode) { assert(new_entry != 0, "only used for clone predicate"); assert(cont_proj->is_uncommon_trap_if_pattern(reason), "must be a uct if pattern!"); IfNode* iff = cont_proj->in(0)->as_If(); ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con);
*** 214,227 **** assert(proj_index < rgn->req(), "sanity"); } // Create new_iff in new location. IfNode* new_iff = NULL; ! if (opcode == Op_If) { new_iff = new IfNode(new_entry, iff->in(1), iff->_prob, iff->_fcnt); } else { ! assert(opcode == Op_RangeCheck, "no other if variant here"); new_iff = new RangeCheckNode(new_entry, iff->in(1), iff->_prob, iff->_fcnt); } register_new_node_with_optimizer(new_iff); Node *if_cont = new IfTrueNode(new_iff); --- 214,227 ---- assert(proj_index < rgn->req(), "sanity"); } // Create new_iff in new location. IfNode* new_iff = NULL; ! if (opcode == Opcodes::Op_If) { new_iff = new IfNode(new_entry, iff->in(1), iff->_prob, iff->_fcnt); } else { ! assert(opcode == Opcodes::Op_RangeCheck, "no other if variant here"); new_iff = new RangeCheckNode(new_entry, iff->in(1), iff->_prob, iff->_fcnt); } register_new_node_with_optimizer(new_iff); Node *if_cont = new IfTrueNode(new_iff);
*** 259,277 **** Deoptimization::DeoptReason reason, PhaseIdealLoop* loop_phase, PhaseIterGVN* igvn) { ProjNode* new_predicate_proj; if (loop_phase != NULL) { ! new_predicate_proj = loop_phase->create_new_if_for_predicate(predicate_proj, new_entry, reason, Op_If); } else { ! new_predicate_proj = igvn->create_new_if_for_predicate(predicate_proj, new_entry, reason, Op_If); } IfNode* iff = new_predicate_proj->in(0)->as_If(); Node* ctrl = iff->in(0); // Match original condition since predicate's projections could be swapped. ! assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); Node* opq = new Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1)); igvn->C->add_predicate_opaq(opq); Node* bol = new Conv2BNode(opq); if (loop_phase != NULL) { --- 259,277 ---- Deoptimization::DeoptReason reason, PhaseIdealLoop* loop_phase, PhaseIterGVN* igvn) { ProjNode* new_predicate_proj; if (loop_phase != NULL) { ! new_predicate_proj = loop_phase->create_new_if_for_predicate(predicate_proj, new_entry, reason, Opcodes::Op_If); } else { ! new_predicate_proj = igvn->create_new_if_for_predicate(predicate_proj, new_entry, reason, Opcodes::Op_If); } IfNode* iff = new_predicate_proj->in(0)->as_If(); Node* ctrl = iff->in(0); // Match original condition since predicate's projections could be swapped. ! assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Opcodes::Op_Opaque1, "must be"); Node* opq = new Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1)); igvn->C->add_predicate_opaq(opq); Node* bol = new Conv2BNode(opq); if (loop_phase != NULL) {
*** 581,595 **** } if (!bol->in(1)->is_Cmp()) { return false; } const CmpNode *cmp = bol->in(1)->as_Cmp(); ! if (cmp->Opcode() != Op_CmpU) { return false; } Node* range = cmp->in(2); ! if (range->Opcode() != Op_LoadRange && !iff->is_RangeCheck()) { const TypeInt* tint = phase->_igvn.type(range)->isa_int(); if (tint == NULL || tint->empty() || tint->_lo < 0) { // Allow predication on positive values that aren't LoadRanges. // This allows optimization of loops where the length of the // array is a known value and doesn't need to be loaded back --- 581,595 ---- } if (!bol->in(1)->is_Cmp()) { return false; } const CmpNode *cmp = bol->in(1)->as_Cmp(); ! if (cmp->Opcode() != Opcodes::Op_CmpU) { return false; } Node* range = cmp->in(2); ! if (range->Opcode() != Opcodes::Op_LoadRange && !iff->is_RangeCheck()) { const TypeInt* tint = phase->_igvn.type(range)->isa_int(); if (tint == NULL || tint->empty() || tint->_lo < 0) { // Allow predication on positive values that aren't LoadRanges. // This allows optimization of loops where the length of the // array is a known value and doesn't need to be loaded back
*** 688,698 **** // Could be a simple region when irreducible loops are present. return false; } LoopNode* head = loop->_head->as_Loop(); ! if (head->unique_ctrl_out()->Opcode() == Op_NeverBranch) { // do nothing for infinite loops return false; } CountedLoopNode *cl = NULL; --- 688,698 ---- // Could be a simple region when irreducible loops are present. return false; } LoopNode* head = loop->_head->as_Loop(); ! if (head->unique_ctrl_out()->Opcode() == Opcodes::Op_NeverBranch) { // do nothing for infinite loops return false; } CountedLoopNode *cl = NULL;
*** 734,745 **** Node_List if_proj_list(area); Node *current_proj = loop->tail(); //start from tail while (current_proj != head) { if (loop == get_loop(current_proj) && // still in the loop ? current_proj->is_Proj() && // is a projection ? ! (current_proj->in(0)->Opcode() == Op_If || ! current_proj->in(0)->Opcode() == Op_RangeCheck)) { // is a if projection ? if_proj_list.push(current_proj); } current_proj = idom(current_proj); } --- 734,745 ---- Node_List if_proj_list(area); Node *current_proj = loop->tail(); //start from tail while (current_proj != head) { if (loop == get_loop(current_proj) && // still in the loop ? current_proj->is_Proj() && // is a projection ? ! (current_proj->in(0)->Opcode() == Opcodes::Op_If || ! current_proj->in(0)->Opcode() == Opcodes::Op_RangeCheck)) { // is a if projection ? if_proj_list.push(current_proj); } current_proj = idom(current_proj); }
*** 804,814 **** // Range check for counted loops const Node* cmp = bol->in(1)->as_Cmp(); Node* idx = cmp->in(1); assert(!invar.is_invariant(idx), "index is variant"); Node* rng = cmp->in(2); ! assert(rng->Opcode() == Op_LoadRange || _igvn.type(rng)->is_int() >= 0, "must be"); assert(invar.is_invariant(rng), "range must be invariant"); int scale = 1; Node* offset = zero; bool ok = is_scaled_iv_plus_offset(idx, cl->phi(), &scale, &offset); assert(ok, "must be index expression"); --- 804,814 ---- // Range check for counted loops const Node* cmp = bol->in(1)->as_Cmp(); Node* idx = cmp->in(1); assert(!invar.is_invariant(idx), "index is variant"); Node* rng = cmp->in(2); ! assert(rng->Opcode() == Opcodes::Op_LoadRange || _igvn.type(rng)->is_int() >= 0, "must be"); assert(invar.is_invariant(rng), "range must be invariant"); int scale = 1; Node* offset = zero; bool ok = is_scaled_iv_plus_offset(idx, cl->phi(), &scale, &offset); assert(ok, "must be index expression");
< prev index next >