* [PATCH] Fix PR66101
@ 2015-05-12 13:42 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2015-05-12 13:42 UTC (permalink / raw)
To: gcc-patches
This fixes PR66101.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
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.
* gcc.dg/torture/pr66101.c: New testcase.
Index: gcc/tree-ssa-dce.c
===================================================================
*** gcc/tree-ssa-dce.c (revision 223044)
--- gcc/tree-ssa-dce.c (working copy)
*************** remove_dead_stmt (gimple_stmt_iterator *
*** 1149,1155 ****
if (e != e2)
{
cfg_altered = true;
! remove_edge (e2);
}
else
ei_next (&ei);
--- 1149,1160 ----
if (e != e2)
{
cfg_altered = true;
! /* 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);
Index: gcc/testsuite/gcc.dg/torture/pr66101.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr66101.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr66101.c (working copy)
***************
*** 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:
+ ;
+ }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-05-12 13:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 13:42 [PATCH] Fix PR66101 Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).