diff options
author | Richard Biener <rguenther@suse.de> | 2024-04-24 06:24:22 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2024-04-24 10:11:00 +0200 |
commit | e28e8ab1a92e9b49f7c4045377577c8dc17751b7 (patch) | |
tree | 2239cbdc97c12fb2bd6a49e8459af06b52008668 | |
parent | d279c9d89b2f6ce89c1eec0ff4b980e9c5f51fd1 (diff) | |
download | gcc-e28e8ab1a92e9b49f7c4045377577c8dc17751b7.zip gcc-e28e8ab1a92e9b49f7c4045377577c8dc17751b7.tar.gz gcc-e28e8ab1a92e9b49f7c4045377577c8dc17751b7.tar.bz2 |
tree-optimization/114832 - wrong dominator info with vect peeling
When we update the dominator of the redirected exit after peeling
we check whether the immediate dominator was the loop header rather
than the exit source when we later want to just update it to the
new source. The following fixes this oversight.
PR tree-optimization/114832
* tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
Fix dominance check.
* gcc.dg/vect/pr114832.c: New testcase.
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr114832.c | 13 | ||||
-rw-r--r-- | gcc/tree-vect-loop-manip.cc | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/pr114832.c b/gcc/testsuite/gcc.dg/vect/pr114832.c new file mode 100644 index 0000000..2de07ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr114832.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-tree-loop-if-convert -fno-tree-loop-distribute-patterns" } */ + +int a, b, c, d[3]; +void e() { + int f, g = 0; + for (; g < 3; g++) { + if (f || a || b && c) { + int h, *i = &h, **j = &i; + } + d[g] = 0; + } +} diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 8d9b533..43c7881 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -1523,7 +1523,7 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loop *loop, edge loop_exit, exit_dest = exit->dest; was_imm_dom = (get_immediate_dominator (CDI_DOMINATORS, - exit_dest) == loop->header ? + exit_dest) == exit->src ? true : false); /* Also copy the pre-header, this avoids jumping through hoops to |