aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-loop-jam.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-08-04 11:55:15 +0200
committerRichard Biener <rguenther@suse.de>2022-08-04 15:01:38 +0200
commitd8552eaddc40b72461158e56b5db8709f2eb21ed (patch)
tree67182b106d8fde0d150858dac0bb1ad0fd1d9dac /gcc/gimple-loop-jam.cc
parentd86d81a449c03641e079f23a2b3e1b2279a162fe (diff)
downloadgcc-d8552eaddc40b72461158e56b5db8709f2eb21ed.zip
gcc-d8552eaddc40b72461158e56b5db8709f2eb21ed.tar.gz
gcc-d8552eaddc40b72461158e56b5db8709f2eb21ed.tar.bz2
tree-optimization/106521 - unroll-and-jam LC SSA rewrite
The LC SSA rewrite performs SSA verification at start but the VN run performed on the unrolled-and-jammed body can leave us with invalid SSA form until CFG cleanup is run. So make sure we do that before rewriting into LC SSA. PR tree-optimization/106521 * gimple-loop-jam.cc (tree_loop_unroll_and_jam): Perform CFG cleanup manually before rewriting into LC SSA. * gcc.dg/torture/pr106521.c: New testcase.
Diffstat (limited to 'gcc/gimple-loop-jam.cc')
-rw-r--r--gcc/gimple-loop-jam.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/gimple-loop-jam.cc b/gcc/gimple-loop-jam.cc
index 8cde6c7..a8a57d3 100644
--- a/gcc/gimple-loop-jam.cc
+++ b/gcc/gimple-loop-jam.cc
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-loop-ivopts.h"
#include "tree-vectorizer.h"
#include "tree-ssa-sccvn.h"
+#include "tree-cfgcleanup.h"
/* Unroll and Jam transformation
@@ -609,9 +610,16 @@ tree_loop_unroll_and_jam (void)
if (todo)
{
+ free_dominance_info (CDI_DOMINATORS);
+ /* We need to cleanup the CFG first since otherwise SSA form can
+ be not up-to-date from the VN run. */
+ if (todo & TODO_cleanup_cfg)
+ {
+ cleanup_tree_cfg ();
+ todo &= ~TODO_cleanup_cfg;
+ }
rewrite_into_loop_closed_ssa (NULL, 0);
scev_reset ();
- free_dominance_info (CDI_DOMINATORS);
}
return todo;
}