http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55270



--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-28 
14:03:18 UTC ---

When propagate_rhs_into_lhs alters the CFG from



   if ()

    {

     if ()

      exit_loop;

    }



to



   if ()

    {

      exit_loop;

    }



it fails to fixup loop structure:



          /* Propagation into these nodes may make certain edges in

             the CFG unexecutable.  We want to identify them as PHI nodes

             at the destination of those unexecutable edges may become

             degenerates.  */

          else if (gimple_code (use_stmt) == GIMPLE_COND

                   || gimple_code (use_stmt) == GIMPLE_SWITCH

                   || gimple_code (use_stmt) == GIMPLE_GOTO)

            {

...



Now, for full propagation the edge wants marking as non-executable

(which is done by removing it here - somewhat premature, as CFG cleanup

is run afterwards anyway and that handles the situation correctly

by calling fix_loop_structure).



Index: gcc/tree-ssa-dom.c

===================================================================

--- gcc/tree-ssa-dom.c  (revision 195502)

+++ gcc/tree-ssa-dom.c  (working copy)

@@ -3006,7 +3006,14 @@ eliminate_degenerate_phis (void)

     }



   if (cfg_altered)

-    free_dominance_info (CDI_DOMINATORS);

+    {

+      free_dominance_info (CDI_DOMINATORS);

+      if (current_loops)

+       {

+         calculate_dominance_info (CDI_DOMINATORS);

+         fix_loop_structure (NULL);

+       }

+    }



   /* Propagation of const and copies may make some EH edges dead.  Purge

      such edges from the CFG as needed.  */



fixes this (one more reason to fix loop structure at loop_optimizer_init

instead ...)

Reply via email to