Something Richi noticed. If the call to thread_block is unsuccessful
when threading a backedge to an interior loop node, then we do not have
to clobber the loop structure. We also need to cleanup in that case.
Bootstrapped and regression tested on x86_64-unknown-linux-gnu.
Installed on the trunk.
Jeff
* tree-ssa-threadupdate.c (thread_through_all_blocks): Do not
clobber the loop structure thread_block was unsuccessful. If
thread_block was unsuccessful, cleanup appropriately.
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 1a52e47..24d0f42 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -1676,13 +1676,20 @@ thread_through_all_blocks (bool may_peel_loop_headers)
{
struct loop *loop = (*path)[0]->e->dest->loop_father;
- retval |= thread_block ((*path)[0]->e->dest, false);
- e->aux = NULL;
-
- /* This jump thread likely totally scrambled this loop.
- So arrange for it to be fixed up. */
- loop->header = NULL;
- loop->latch = NULL;
+ if (thread_block ((*path)[0]->e->dest, false))
+ {
+ /* This jump thread likely totally scrambled this loop.
+ So arrange for it to be fixed up. */
+ loop->header = NULL;
+ loop->latch = NULL;
+ e->aux = NULL;
+ }
+ else
+ {
+ delete_jump_thread_path (path);
+ e->aux = NULL;
+ ei_next (&ei);
+ }
}
}
else