]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2015-05-12 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 May 2015 13:28:33 +0000 (13:28 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 May 2015 13:28:33 +0000 (13:28 +0000)
PR tree-optimization/66101
* tree-ssa-dce.c (remove_dead_stmt): Properly mark loops for
fixup if we turn a loop exit edge to a fallthru edge.

* gcc.dg/torture/pr66101.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223065 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr66101.c [new file with mode: 0644]
gcc/tree-ssa-dce.c

index adc96c32b007341432bfd9688cd1d37852b4013b..d3739c2d41db496acce6588add2576efc8916c11 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-12  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/66101
+       * tree-ssa-dce.c (remove_dead_stmt): Properly mark loops for
+       fixup if we turn a loop exit edge to a fallthru edge.
+
 2015-05-12  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/37021
index 9819e2a7731fe9e3100615b2360255561e2f21e6..558a676e96f506c77901ac94bf3c41f576eb2835 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-12  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/66101
+       * gcc.dg/torture/pr66101.c: New testcase.
+
 2015-05-12  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/37021
diff --git a/gcc/testsuite/gcc.dg/torture/pr66101.c b/gcc/testsuite/gcc.dg/torture/pr66101.c
new file mode 100644 (file)
index 0000000..f3ef5e5
--- /dev/null
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+
+#include <setjmp.h>
+
+jmp_buf env;
+
+int a, c, d, e;
+
+int
+bar ()
+{
+  int b = *(long *) 7 == 5 ? : 0;
+  if (a || a > b)
+    longjmp (env, 0);
+  return 1;
+}
+
+void
+foo ()
+{
+  long f;
+  setjmp (env);
+  for (; d; c++)
+    switch (c)
+case 0:
+      {
+       f = bar () >> 1;
+       if (e)
+         goto L;
+       if (bar () >> 1)
+         goto L;
+      }
+L:
+    ;
+}
index c9cb0e4895350446bbe16e8134c111fc05b8b342..df30614280478c4d3724fe1a04a4010f119706bf 100644 (file)
@@ -1149,7 +1149,12 @@ remove_dead_stmt (gimple_stmt_iterator *i, basic_block bb)
        if (e != e2)
          {
            cfg_altered = true;
-            remove_edge (e2);
+           /* If we made a BB unconditionally exit a loop then this
+              transform alters the set of BBs in the loop.  Schedule
+              a fixup.  */
+           if (loop_exit_edge_p (bb->loop_father, e))
+             loops_state_set (LOOPS_NEED_FIXUP);
+           remove_edge (e2);
          }
        else
          ei_next (&ei);