]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/52803 (ICE: in ira, at ira.c:3616 with -fno-move-loop-invarian...
authorRichard Guenther <rguenther@suse.de>
Mon, 2 Apr 2012 11:59:47 +0000 (11:59 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 2 Apr 2012 11:59:47 +0000 (11:59 +0000)
2012-04-02  Richard Guenther  <rguenther@suse.de>

PR middle-end/52803
* loop-init.c (gate_handle_loop2): Destroy loops here if
we don't enter RTL loop optimizers.

* gcc.dg/pr52803.c: New testcase.

From-SVN: r186080

gcc/ChangeLog
gcc/loop-init.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr52803.c [new file with mode: 0644]

index e5abe458bf6c242a2b9dde8b849659c4423a5b5d..ef6425cfe601183b762409e5e5f84bd8c4b53f32 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-02  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/52803
+       * loop-init.c (gate_handle_loop2): Destroy loops here if
+       we don't enter RTL loop optimizers.
+
 2012-04-02  Uros Bizjak  <ubizjak@gmail.com>
 
        Partially revert:
index b8d7b7ee7ce9b3801a6c0fa202634f362d296be1..03f8f610c97fe8bc5eda3531ffc30d2921290f33 100644 (file)
@@ -158,15 +158,24 @@ loop_optimizer_finalize (void)
 static bool
 gate_handle_loop2 (void)
 {
-  return (optimize > 0
-         && (flag_move_loop_invariants
-              || flag_unswitch_loops
-              || flag_peel_loops
-              || flag_unroll_loops
+  if (optimize > 0
+      && (flag_move_loop_invariants
+         || flag_unswitch_loops
+         || flag_peel_loops
+         || flag_unroll_loops
 #ifdef HAVE_doloop_end
-             || (flag_branch_on_count_reg && HAVE_doloop_end)
+         || (flag_branch_on_count_reg && HAVE_doloop_end)
 #endif
-             ));
+        ))
+    return true;
+  else
+    {
+      /* No longer preserve loops, remove them now.  */
+      cfun->curr_properties &= ~PROP_loops;
+      if (current_loops)
+       loop_optimizer_finalize ();
+      return false;
+    } 
 }
 
 struct rtl_opt_pass pass_loop2 =
index bfad9a7b77a407d58fd8c87b318b6cc9bd7bd877..2d95e0ed0d9db89e1c64a8cad567bb0e26105a88 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-02  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/52803
+       * gcc.dg/pr52803.c: New testcase.
+
 2012-04-02  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/40942
diff --git a/gcc/testsuite/gcc.dg/pr52803.c b/gcc/testsuite/gcc.dg/pr52803.c
new file mode 100644 (file)
index 0000000..6774b0c
--- /dev/null
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-move-loop-invariants" } */
+
+int main () { return 0; }