src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/opto/compile.cpp	Thu Jan  7 16:01:51 2010
--- new/src/share/vm/opto/compile.cpp	Thu Jan  7 16:01:51 2010

*** 930,939 **** --- 930,940 ---- // A NULL adr_type hits in the cache right away. Preload the right answer. probe_alias_cache(NULL)->_index = AliasIdxTop; _intrinsics = NULL; _macro_nodes = new GrowableArray<Node*>(comp_arena(), 8, 0, NULL); + _predicate_opaqs = new GrowableArray<Node*>(comp_arena(), 8, 0, NULL); register_library_intrinsics(); } //---------------------------init_start---------------------------------------- // Install the StartNode on this compile object.
*** 1551,1560 **** --- 1552,1574 ---- while ((call = pop_warm_call()) != NULL) { call->make_cold(); } } + //---------------------cleanup_loop_predicates----------------------- + // Remove the opaque nodes that protect the predicates so that all unused + // checks and uncommon_traps will be eliminated from the ideal graph + void Compile::cleanup_loop_predicates(PhaseIterGVN &igvn) { + if (predicate_count()==0 ) return; + for (int i = predicate_count(); i > 0; i--) { + Node * n = predicate_opaque1_node(i-1); + assert(n->Opcode() == Op_Opaque1, "must be"); + igvn.replace_node(n, n->in(1)); + } + assert(predicate_count()==0, "should be clean!"); + igvn.optimize(); + } //------------------------------Optimize--------------------------------------- // Given a graph, optimize it. void Compile::Optimize() { TracePhase t1("optimizer", &_t_optimizer, true);
*** 1592,1618 **** --- 1606,1632 ---- // Set loop opts counter loop_opts_cnt = num_loop_opts(); if((loop_opts_cnt > 0) && (has_loops() || has_split_ifs())) { { TracePhase t2("idealLoop", &_t_idealLoop, true); ! PhaseIdealLoop ideal_loop( igvn, true, UseLoopPredicate); loop_opts_cnt--; if (major_progress()) print_method("PhaseIdealLoop 1", 2); if (failing()) return; } // Loop opts pass if partial peeling occurred in previous pass if(PartialPeelLoop && major_progress() && (loop_opts_cnt > 0)) { TracePhase t3("idealLoop", &_t_idealLoop, true); ! PhaseIdealLoop ideal_loop( igvn, false, UseLoopPredicate); loop_opts_cnt--; if (major_progress()) print_method("PhaseIdealLoop 2", 2); if (failing()) return; } // Loop opts pass for loop-unrolling before CCP if(major_progress() && (loop_opts_cnt > 0)) { TracePhase t4("idealLoop", &_t_idealLoop, true); ! PhaseIdealLoop ideal_loop( igvn, false, UseLoopPredicate); loop_opts_cnt--; if (major_progress()) print_method("PhaseIdealLoop 3", 2); } if (!failing()) { // Verify that last round of loop opts produced a valid graph
*** 1646,1664 **** --- 1660,1686 ---- // Loop transforms on the ideal graph. Range Check Elimination, // peeling, unrolling, etc. if(loop_opts_cnt > 0) { debug_only( int cnt = 0; ); + bool loop_predication = UseLoopPredicate; while(major_progress() && (loop_opts_cnt > 0)) { TracePhase t2("idealLoop", &_t_idealLoop, true); assert( cnt++ < 40, "infinite cycle in loop optimization" ); ! PhaseIdealLoop ideal_loop( igvn, true, loop_predication); loop_opts_cnt--; if (major_progress()) print_method("PhaseIdealLoop iterations", 2); if (failing()) return; + // Perform loop predication optimization during first iteration after CCP. + // After that switch it off and cleanup unused loop predicates. + if (loop_predication) { + loop_predication = false; + cleanup_loop_predicates(igvn); + if (failing()) return; } } + } { // Verify that all previous optimizations produced a valid graph // at least to this point, even if no loop optimizations were done. NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); )

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