From 07643d76c74845e250bdedca6b7148ebccff780b Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Fri, 8 Apr 2011 15:49:43 +0400 Subject: [PATCH] re PR target/48273 (ICE: in create_copy_of_insn_rtx, at sel-sched-ir.c:5604 with -fsel-sched-pipelining -fselective-scheduling2 -march=core2) PR target/48273 * cfgloop.h (loop_has_exit_edges): New helper. * sel-sched-ir.c (init_global_and_expr_for_insn): Make CALLs non-clonable. * sel-sched.c (sel_setup_region_sched_flags): Don't pipeline loops that have no exit edges. testsuite: * g++.dg/opt/pr48273.C: New. From-SVN: r172175 --- gcc/ChangeLog | 9 +++++++++ gcc/cfgloop.h | 8 ++++++++ gcc/sel-sched-ir.c | 1 + gcc/sel-sched.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/opt/pr48273.C | 10 ++++++++++ 6 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr48273.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b357ba76939..523c3b704cf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2011-04-08 Alexander Monakov + + PR target/48273 + * cfgloop.h (loop_has_exit_edges): New helper. + * sel-sched-ir.c (init_global_and_expr_for_insn): Make CALLs + non-clonable. + * sel-sched.c (sel_setup_region_sched_flags): Don't pipeline loops + that have no exit edges. + 2011-04-08 Alexander Monakov PR rtl-optimization/48442 diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index f7bb1341a63..0ff44de67d3 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -443,6 +443,14 @@ loop_outer (const struct loop *loop) return VEC_index (loop_p, loop->superloops, n - 1); } +/* Returns true if LOOP has at least one exit edge. */ + +static inline bool +loop_has_exit_edges (const struct loop *loop) +{ + return loop->exits->next->e != NULL; +} + /* Returns the list of loops in current_loops. */ static inline VEC (loop_p, gc) * diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 67484dd77d9..95c1431001e 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 0e8173b3ddd..fb1a026bf28 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -6781,7 +6781,8 @@ 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 + && loop_has_exit_edges (current_loop_nest)); max_insns_to_rename = PARAM_VALUE (PARAM_SELSCHED_INSNS_TO_RENAME); max_ws = MAX_WS; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e311e804439..96c224fcfec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-04-08 Alexander Monakov + + PR target/48273 + * g++.dg/opt/pr48273.C: New. + 2011-04-08 Alexander Monakov PR rtl-optimization/48442 diff --git a/gcc/testsuite/g++.dg/opt/pr48273.C b/gcc/testsuite/g++.dg/opt/pr48273.C new file mode 100644 index 00000000000..4c5108bdd26 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr48273.C @@ -0,0 +1,10 @@ +// { dg-do compile { target x86_64-*-* } } +// { dg-options "-fschedule-insns2 -fsel-sched-pipelining -fselective-scheduling2 -funroll-all-loops -march=core2" } + +void bar (); + +void foo () +{ + for (;;) + bar (); +} -- 2.30.2