http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48273

--- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> 2011-04-06 
14:40:28 UTC ---
There's little value in allowing bookkeeping for calls, and the (untested yet)
patch below forces calls to be unique.  The test case also shows that our
remove_insns_that_need_bookkeeping function works incorrectly for infinite
loops (the single basic block dominates itself, and SPEC of the pipelined
instruction is not increased because there's no conditional branch). It's
possible to fix up that function by also looking at INSN_SCHED_TIMES, but the
simpler way is to forbid pipelining for infinite loops.

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 67484dd..95c1431 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -2905,6 +2905,7 @@ init_global_and_expr_for_insn (insn_t insn)
       if (CANT_MOVE (insn)
           || INSN_ASM_P (insn)
           || SCHED_GROUP_P (insn)
+      || CALL_P (insn)
           /* Exception handling insns are always unique.  */
           || (cfun->can_throw_non_call_exceptions && can_throw_internal
(insn))
           /* TRAP_IF though have an INSN code is control_flow_insn_p ().  */
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 0e8173b..415eaa4 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -6781,7 +6781,9 @@ sel_setup_region_sched_flags (void)
   bookkeeping_p = 1;
   pipelining_p = (bookkeeping_p
                   && (flag_sel_sched_pipelining != 0)
-          && current_loop_nest != NULL);
+          && current_loop_nest != NULL
+          /* Check that there is at least one exit.  */
+          && current_loop_nest->exits->next->e);
   max_insns_to_rename = PARAM_VALUE (PARAM_SELSCHED_INSNS_TO_RENAME);
   max_ws = MAX_WS;
 }

Reply via email to