public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-145] Fix latent bug in loop header copying which forgets to update the loop header pointer
@ 2023-04-21 13:54 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2023-04-21 13:54 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2f4e45101dd812a6fcc1e5d96efedc60b8735432
commit r14-145-g2f4e45101dd812a6fcc1e5d96efedc60b8735432
Author: Jan Hubicka <jh@suse.cz>
Date: Fri Apr 21 15:53:21 2023 +0200
Fix latent bug in loop header copying which forgets to update the loop header pointer
gcc/ChangeLog:
2023-04-21 Jan Hubicka <hubicka@ucw.cz>
Ondrej Kubanek <kubanek0ondrej@gmail.com>
* tree-ssa-loop-ch.cc (ch_base::copy_headers): Update loop header and
latch.
Diff:
---
gcc/tree-ssa-loop-ch.cc | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/gcc/tree-ssa-loop-ch.cc b/gcc/tree-ssa-loop-ch.cc
index ddf025c0cfd..560df39893e 100644
--- a/gcc/tree-ssa-loop-ch.cc
+++ b/gcc/tree-ssa-loop-ch.cc
@@ -542,6 +542,17 @@ ch_base::copy_headers (function *fun)
}
}
+ /* Update header of the loop. */
+ loop->header = header;
+ /* 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. */
+ 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));
@@ -561,6 +572,8 @@ 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-21 13:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21 13:54 [gcc r14-145] Fix latent bug in loop header copying which forgets to update the loop header pointer Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).