]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR ipa/60518 (ICE: in verify_loop_structure, at cfgloop.c:1647)
authorRichard Biener <rguenth@gcc.gnu.org>
Fri, 14 Mar 2014 12:54:25 +0000 (12:54 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 14 Mar 2014 12:54:25 +0000 (12:54 +0000)
2014-03-14  Richard Biener  <rguenther@suse.de>

PR middle-end/60518
* cfghooks.c (split_block): Properly adjust all loops the
block was a latch of.

* g++.dg/pr60518.C: New testcase.

From-SVN: r208567

gcc/ChangeLog
gcc/cfghooks.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr60518.C [new file with mode: 0644]

index b2c7072cc20465c3a5d88e561a2516ef609d61f2..95ae779284e9d123362477e5622ff5ce2b00f36a 100644 (file)
@@ -1,4 +1,10 @@
-2014-03-13  Martin Jambor  <mjambor@suse.cz>
+2014-03-14  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/60518
+       * cfghooks.c (split_block): Properly adjust all loops the
+       block was a latch of.
+
+2014-03-14  Martin Jambor  <mjambor@suse.cz>
 
        PR lto/60461
        * ipa-prop.c (ipa_modify_call_arguments): Fix iteration condition
index 7cf3cd50a6697fe391c684139368add6e1bccee6..bc1634aac879abba8130dd2e0febe7efc9f07c1d 100644 (file)
@@ -510,9 +510,13 @@ split_block (basic_block bb, void *i)
 
   if (current_loops != NULL)
     {
+      edge_iterator ei;
+      edge e;
       add_bb_to_loop (new_bb, bb->loop_father);
-      if (bb->loop_father->latch == bb)
-       bb->loop_father->latch = new_bb;
+      /* Identify all loops bb may have been the latch of and adjust them.  */
+      FOR_EACH_EDGE (e, ei, new_bb->succs)
+       if (e->dest->loop_father->latch == bb)
+         e->dest->loop_father->latch = new_bb;
     }
 
   res = make_single_succ_edge (bb, new_bb, EDGE_FALLTHRU);
index 7f7c9743567f10b7e3d9782bc2d7f5a9f1cdffb3..97e6bba73811a6b47e0679df5e14e7113d12d1c9 100644 (file)
@@ -1,4 +1,9 @@
-2014-03-13  Martin Jambor  <mjambor@suse.cz>
+2014-03-14  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/60518
+       * g++.dg/pr60518.C: New testcase.
+
+2014-03-14  Martin Jambor  <mjambor@suse.cz>
 
        PR lto/60461
        * gcc.dg/lto/pr60461_0.c: New test.
diff --git a/gcc/testsuite/g++.dg/pr60518.C b/gcc/testsuite/g++.dg/pr60518.C
new file mode 100644 (file)
index 0000000..e3da48a
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-Os -fprofile-use" }
+
+int a;
+int fn1 () { return a == ',' || a == ';'; }
+
+void fn2 ()
+{
+    do
+          while (fn1 ())
+                 ;
+      while (1);
+}