re PR target/48273 (ICE: in create_copy_of_insn_rtx, at sel-sched-ir.c:5604 with...
authorAlexander Monakov <amonakov@ispras.ru>
Fri, 8 Apr 2011 11:49:43 +0000 (15:49 +0400)
committerAlexander Monakov <amonakov@gcc.gnu.org>
Fri, 8 Apr 2011 11:49:43 +0000 (15:49 +0400)
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
gcc/cfgloop.h
gcc/sel-sched-ir.c
gcc/sel-sched.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr48273.C [new file with mode: 0644]

index b357ba769390b7736826df2ac531b892c2cfe512..523c3b704cf2534653f6bce9726dd2f9f929ae0b 100644 (file)
@@ -1,3 +1,12 @@
+2011-04-08  Alexander Monakov  <amonakov@ispras.ru>
+
+       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  <amonakov@ispras.ru>
 
        PR rtl-optimization/48442
index f7bb1341a63c261ee6185ffbfaee7a7768774399..0ff44de67d34154643b64dbedb1839899d6f1ec9 100644 (file)
@@ -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) *
index 67484dd77d9fc86c6012a736e9bbfbb791b7464c..95c1431001ed8db4813d1c7e5ff20d77e89e30bf 100644 (file)
@@ -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 ().  */
index 0e8173b3dddee8f58eb071281094574d34f0e413..fb1a026bf28a2657882853c2d4dac730f11b0440 100644 (file)
@@ -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;
 }
index e311e804439b1b85e040328f70028506288883f7..96c224fcfec6c4961067c1abf5bc623ef8e66d0e 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-08  Alexander Monakov  <amonakov@ispras.ru>
+
+       PR target/48273
+       * g++.dg/opt/pr48273.C: New.
+
 2011-04-08  Alexander Monakov  <amonakov@ispras.ru>
 
        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 (file)
index 0000000..4c5108b
--- /dev/null
@@ -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 ();
+}