aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadupdate.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2015-08-03 10:26:13 -0600
committerJeff Law <law@gcc.gnu.org>2015-08-03 10:26:13 -0600
commitc2a96ec20fc81a90fc6c0cc665db721cccab304b (patch)
treeb6eda946d09f05a3bee4ad8a49842108ce1319e6 /gcc/tree-ssa-threadupdate.c
parent93411db8c7880db31a3d6d6922845bf03cd665cc (diff)
downloadgcc-c2a96ec20fc81a90fc6c0cc665db721cccab304b.zip
gcc-c2a96ec20fc81a90fc6c0cc665db721cccab304b.tar.gz
gcc-c2a96ec20fc81a90fc6c0cc665db721cccab304b.tar.bz2
re PR middle-end/66314 (ice in verify_loop_structure)
PR middle-end/66314 PR gcov-profile/66899 * tree-ssa-threadupdate.c (mark_threaded_blocks): Correctly iterate over the jump threading paths when an element in the jump threading paths array is eliminated. PR middle-end/66314 PR gcov-profile/66899 * gcc.dg/pr66899.c: New test. * gcc.dg/pr66314.c: New test. From-SVN: r226516
Diffstat (limited to 'gcc/tree-ssa-threadupdate.c')
-rw-r--r--gcc/tree-ssa-threadupdate.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 31ddf25..5a5f8df 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -2130,7 +2130,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
cases where the second path starts at a downstream edge on the same
path). First record all joiner paths, deleting any in the unexpected
case where there is already a path for that incoming edge. */
- for (i = 0; i < paths.length (); i++)
+ for (i = 0; i < paths.length ();)
{
vec<jump_thread_edge *> *path = paths[i];
@@ -2140,6 +2140,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
if ((*path)[0]->e->aux == NULL)
{
(*path)[0]->e->aux = path;
+ i++;
}
else
{
@@ -2149,10 +2150,15 @@ mark_threaded_blocks (bitmap threaded_blocks)
delete_jump_thread_path (path);
}
}
+ else
+ {
+ i++;
+ }
}
+
/* Second, look for paths that have any other jump thread attached to
them, and either finish converting them or cancel them. */
- for (i = 0; i < paths.length (); i++)
+ for (i = 0; i < paths.length ();)
{
vec<jump_thread_edge *> *path = paths[i];
edge e = (*path)[0]->e;
@@ -2167,7 +2173,10 @@ mark_threaded_blocks (bitmap threaded_blocks)
/* If we iterated through the entire path without exiting the loop,
then we are good to go, record it. */
if (j == path->length ())
- bitmap_set_bit (tmp, e->dest->index);
+ {
+ bitmap_set_bit (tmp, e->dest->index);
+ i++;
+ }
else
{
e->aux = NULL;
@@ -2177,6 +2186,10 @@ mark_threaded_blocks (bitmap threaded_blocks)
delete_jump_thread_path (path);
}
}
+ else
+ {
+ i++;
+ }
}
/* If optimizing for size, only thread through block if we don't have