From patchwork Tue Jan 29 10:39:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix PR55270 Date: Tue, 29 Jan 2013 00:39:15 -0000 From: Richard Guenther X-Patchwork-Id: 216500 Message-Id: To: gcc-patches@gcc.gnu.org This fixes PR55270 - we need to fixup loops after phicprop as that removes edges without doing so. The following patch makes us rely on cfgcleanup scheduled after the pass for this. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2013-01-29 Richard Biener PR tree-optimization/55270 * tree-ssa-dom.c (eliminate_degenerate_phis): If we changed the CFG, schedule loops for fixup. * gcc.dg/torture/pr55270.c: New testcase. Index: gcc/tree-ssa-dom.c =================================================================== --- gcc/tree-ssa-dom.c (revision 195530) +++ gcc/tree-ssa-dom.c (working copy) @@ -3006,7 +3006,12 @@ eliminate_degenerate_phis (void) } if (cfg_altered) - free_dominance_info (CDI_DOMINATORS); + { + free_dominance_info (CDI_DOMINATORS); + /* If we changed the CFG schedule loops for fixup by cfgcleanup. */ + if (current_loops) + loops_state_set (LOOPS_NEED_FIXUP); + } /* Propagation of const and copies may make some EH edges dead. Purge such edges from the CFG as needed. */ Index: gcc/testsuite/gcc.dg/torture/pr55270.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr55270.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr55270.c (working copy) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ + +unsigned a, b, c; + +void f(void) +{ + for(; a; a++) + { + long *p1 = (long *)&b; + + if(*p1) + return; + + if(b && (*p1 = b) || c && ++*p1) + { + unsigned *p2 = &b; + + for(*p2 = 0; *p2 < 1;) + for(; b; b++); + } + } +}