aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2023-04-21 18:13:35 +0200
committerJan Hubicka <jh@suse.cz>2023-04-21 18:14:52 +0200
commitf7b9258e0d4127c1f441440c9a9c794295bbbe0f (patch)
tree1dd37d8609aa6b30f68b6a9591e3b12f8a00bfc7
parent1fe9bef9f5536e46b901139631863b3b86b97898 (diff)
downloadgcc-f7b9258e0d4127c1f441440c9a9c794295bbbe0f.zip
gcc-f7b9258e0d4127c1f441440c9a9c794295bbbe0f.tar.gz
gcc-f7b9258e0d4127c1f441440c9a9c794295bbbe0f.tar.bz2
Fix boostrap failure in tree-ssa-loop-ch.cc
I managed to mix up patch and its WIP version in previous commit. This patch adds the missing edge iterator and also fixes a side case where new loop header would have multiple latches. gcc/ChangeLog: * tree-ssa-loop-ch.cc (ch_base::copy_headers): Fix previous commit.
-rw-r--r--gcc/tree-ssa-loop-ch.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/tree-ssa-loop-ch.cc b/gcc/tree-ssa-loop-ch.cc
index 560df39..0025bc1 100644
--- a/gcc/tree-ssa-loop-ch.cc
+++ b/gcc/tree-ssa-loop-ch.cc
@@ -484,7 +484,10 @@ ch_base::copy_headers (function *fun)
/* Ensure that the header will have just the latch as a predecessor
inside the loop. */
if (!single_pred_p (exit->dest))
- exit = single_pred_edge (split_edge (exit));
+ {
+ header = split_edge (exit);
+ exit = single_pred_edge (header);
+ }
entry = loop_preheader_edge (loop);
@@ -547,16 +550,17 @@ ch_base::copy_headers (function *fun)
/* Find correct latch. We only duplicate chain of conditionals so
there should be precisely two edges to the new header. One entry
edge and one to latch. */
+ edge_iterator ei;
+ edge e;
FOR_EACH_EDGE (e, ei, loop->header->preds)
if (header != e->src)
{
loop->latch = e->src;
break;
}
- /* Ensure that the latch and the preheader is simple (we know that they
- are not now, since there was the loop exit condition. */
- split_edge (loop_preheader_edge (loop));
- split_edge (loop_latch_edge (loop));
+ /* Ensure that the latch is simple. */
+ if (!single_succ_p (loop_latch_edge (loop)->src))
+ split_edge (loop_latch_edge (loop));
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -572,8 +576,6 @@ ch_base::copy_headers (function *fun)
if (changed)
{
- if (flag_checking)
- verify_loop_structure ();
update_ssa (TODO_update_ssa);
/* After updating SSA form perform CSE on the loop header
copies. This is esp. required for the pass before