aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop-unroll.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2013-02-28 10:13:48 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2013-02-28 10:13:48 +0000
commit45fa0eef76179a17ab3a34283683856ab7ba5f17 (patch)
tree666ccd47fad9a9f01055af3366f1d252e2e6761a /gcc/loop-unroll.c
parent502c067d54d373d7a8769b481bbae6279fb701f1 (diff)
downloadgcc-45fa0eef76179a17ab3a34283683856ab7ba5f17.zip
gcc-45fa0eef76179a17ab3a34283683856ab7ba5f17.tar.gz
gcc-45fa0eef76179a17ab3a34283683856ab7ba5f17.tar.bz2
re PR rtl-optimization/56466 (ICE in verify_loop_structure, at cfgloop.c:1629 (loop with header n not in loop tree !))
PR rtl-optimization/56466 * loop-unroll.c (unroll_and_peel_loops): Call fix_loop_structure if we're changing a loop. (peel_loops_completely): Likewise. From-SVN: r196335
Diffstat (limited to 'gcc/loop-unroll.c')
-rw-r--r--gcc/loop-unroll.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 42512b8..1eb904b 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -207,7 +207,7 @@ void
unroll_and_peel_loops (int flags)
{
struct loop *loop;
- bool check;
+ bool changed = false;
loop_iterator li;
/* First perform complete loop peeling (it is almost surely a win,
@@ -220,7 +220,6 @@ unroll_and_peel_loops (int flags)
/* Scan the loops, inner ones first. */
FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
{
- check = true;
/* And perform the appropriate transformations. */
switch (loop->lpt_decision.decision)
{
@@ -229,30 +228,33 @@ unroll_and_peel_loops (int flags)
gcc_unreachable ();
case LPT_PEEL_SIMPLE:
peel_loop_simple (loop);
+ changed = true;
break;
case LPT_UNROLL_CONSTANT:
unroll_loop_constant_iterations (loop);
+ changed = true;
break;
case LPT_UNROLL_RUNTIME:
unroll_loop_runtime_iterations (loop);
+ changed = true;
break;
case LPT_UNROLL_STUPID:
unroll_loop_stupid (loop);
+ changed = true;
break;
case LPT_NONE:
- check = false;
break;
default:
gcc_unreachable ();
}
- if (check)
- {
-#ifdef ENABLE_CHECKING
- verify_loop_structure ();
-#endif
- }
}
+ if (changed)
+ {
+ calculate_dominance_info (CDI_DOMINATORS);
+ fix_loop_structure (NULL);
+ }
+
iv_analysis_done ();
}
@@ -283,6 +285,7 @@ peel_loops_completely (int flags)
{
struct loop *loop;
loop_iterator li;
+ bool changed = false;
/* Scan the loops, the inner ones first. */
FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
@@ -306,11 +309,15 @@ peel_loops_completely (int flags)
{
report_unroll_peel (loop, locus);
peel_loop_completely (loop);
-#ifdef ENABLE_CHECKING
- verify_loop_structure ();
-#endif
+ changed = true;
}
}
+
+ if (changed)
+ {
+ calculate_dominance_info (CDI_DOMINATORS);
+ fix_loop_structure (NULL);
+ }
}
/* Decide whether unroll or peel loops (depending on FLAGS) and how much. */