This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR71398
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 6 Jun 2016 08:54:17 +0200 (CEST)
- Subject: [PATCH] Fix PR71398
- Authentication-results: sourceware.org; auth=none
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2016-06-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/71398
* tree-ssa-loop-ivcanon.c (unloop_loops): First unloop, then
remove edges.
* gcc.dg/torture/pr71398.c: New testcase.
Index: gcc/tree-ssa-loop-ivcanon.c
===================================================================
*** gcc/tree-ssa-loop-ivcanon.c (revision 237053)
--- gcc/tree-ssa-loop-ivcanon.c (working copy)
*************** static void
*** 615,630 ****
unloop_loops (bitmap loop_closed_ssa_invalidated,
bool *irred_invalidated)
{
- /* First remove edges in peeled copies. */
- unsigned i;
- edge e;
- FOR_EACH_VEC_ELT (edges_to_remove, i, e)
- {
- bool ok = remove_path (e);
- gcc_assert (ok);
- }
- edges_to_remove.release ();
-
while (loops_to_unloop.length ())
{
struct loop *loop = loops_to_unloop.pop ();
--- 637,642 ----
*************** unloop_loops (bitmap loop_closed_ssa_inv
*** 660,665 ****
--- 672,687 ----
}
loops_to_unloop.release ();
loops_to_unloop_nunroll.release ();
+
+ /* Remove edges in peeled copies. */
+ unsigned i;
+ edge e;
+ FOR_EACH_VEC_ELT (edges_to_remove, i, e)
+ {
+ bool ok = remove_path (e);
+ gcc_assert (ok);
+ }
+ edges_to_remove.release ();
}
/* Tries to unroll LOOP completely, i.e. NITER times.
Index: gcc/testsuite/gcc.dg/torture/pr71398.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr71398.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr71398.c (working copy)
***************
*** 0 ****
--- 1,17 ----
+ /* { dg-do compile } */
+
+ unsigned a, b, c[1];
+ void __assert_fail() __attribute__((__noreturn__));
+ void fn1()
+ {
+ int d;
+ unsigned e;
+ for (;;)
+ {
+ d = 0;
+ for (; d <= 6; d++)
+ c[d] || a ? 0 : __assert_fail();
+ for (; e <= 5; e++)
+ a = b;
+ }
+ }