aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-11-15 11:07:55 +0100
committerRichard Biener <rguenther@suse.de>2021-11-15 11:10:16 +0100
commitd1ca8aeaf34a717dffd8f4a1f0333d25c7d1c904 (patch)
tree12c012ce8f53fcbff9b03e8b7cd492727d1bec3c /gcc
parent2551cd4f9bc1afee444a56e03c1cee6899593da9 (diff)
downloadgcc-d1ca8aeaf34a717dffd8f4a1f0333d25c7d1c904.zip
gcc-d1ca8aeaf34a717dffd8f4a1f0333d25c7d1c904.tar.gz
gcc-d1ca8aeaf34a717dffd8f4a1f0333d25c7d1c904.tar.bz2
tree-optimization/103219 - avoid ICE in unroll-and-jam
For no particularly good reason unroll-and-jam uses single_dom_exit to determine the exit for the region it wants to run VN on. That happens to ICE because of the dominance restriction. Use single_exit instead. 2021-11-15 Richard Biener <rguenther@suse.de> PR tree-optimization/103219 * gimple-loop-jam.c (tree_loop_unroll_and_jam): Use single_exit to determine the exit for the VN region. * gcc.dg/torture/pr103219.c: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gimple-loop-jam.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr103219.c24
2 files changed, 25 insertions, 1 deletions
diff --git a/gcc/gimple-loop-jam.c b/gcc/gimple-loop-jam.c
index 611d380..666f740 100644
--- a/gcc/gimple-loop-jam.c
+++ b/gcc/gimple-loop-jam.c
@@ -593,7 +593,7 @@ tree_loop_unroll_and_jam (void)
todo |= TODO_cleanup_cfg;
auto_bitmap exit_bbs;
- bitmap_set_bit (exit_bbs, single_dom_exit (outer)->dest->index);
+ bitmap_set_bit (exit_bbs, single_exit (outer)->dest->index);
todo |= do_rpo_vn (cfun, loop_preheader_edge (outer), exit_bbs);
}
diff --git a/gcc/testsuite/gcc.dg/torture/pr103219.c b/gcc/testsuite/gcc.dg/torture/pr103219.c
new file mode 100644
index 0000000..cb9023e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr103219.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+
+int f();
+void g();
+int a, b, c, e;
+int d[10];
+int main()
+{
+ if (c)
+ if (f())
+ {
+ g();
+ if (e) {
+ a = 0;
+ for (; a != 6; a = a + 2)
+ {
+ b = 0;
+ for (; b <= 3; b++)
+ d[b] &= 1;
+ }
+ }
+ }
+ return 0;
+}