[patch] for PR 27872

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Tue Jun 6 09:01:00 GMT 2006


Hello,

we forget to set EDGE_IRREDUCIBLE_LOOP flag on one of the edges during
loop unrolling, thus causing this ICE.  The following patch fixes the
problem.  Bootstrapped & regtested on i686.

Zdenek

	PR tree-optimization/27872
	* tree-ssa-loop-manip.c (tree_unroll_loop): Set EDGE_IRREDUCIBLE_LOOP
	flag on the new exit edge of the unrolled loop.

Index: tree-ssa-loop-manip.c
===================================================================
*** tree-ssa-loop-manip.c	(revision 114387)
--- tree-ssa-loop-manip.c	(working copy)
*************** tree_unroll_loop (struct loops *loops, s
*** 841,846 ****
--- 841,847 ----
    use_operand_p op;
    bool ok;
    unsigned est_niter;
+   unsigned irr = loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP;
    sbitmap wont_exit;
  
    est_niter = expected_loop_iterations (loop);
*************** tree_unroll_loop (struct loops *loops, s
*** 883,889 ****
    loop_split_edge_with (loop_latch_edge (loop), NULL);
    exit_bb = single_pred (loop->latch);
  
!   new_exit = make_edge (exit_bb, rest, EDGE_FALSE_VALUE);
    new_exit->count = loop_preheader_edge (loop)->count;
    est_niter = est_niter / factor + 1;
    new_exit->probability = REG_BR_PROB_BASE / est_niter;
--- 884,890 ----
    loop_split_edge_with (loop_latch_edge (loop), NULL);
    exit_bb = single_pred (loop->latch);
  
!   new_exit = make_edge (exit_bb, rest, EDGE_FALSE_VALUE | irr);
    new_exit->count = loop_preheader_edge (loop)->count;
    est_niter = est_niter / factor + 1;
    new_exit->probability = REG_BR_PROB_BASE / est_niter;



More information about the Gcc-patches mailing list