public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5264] tree-optimization/103219 - avoid ICE in unroll-and-jam
@ 2021-11-15 10:10 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-11-15 10:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d1ca8aeaf34a717dffd8f4a1f0333d25c7d1c904

commit r12-5264-gd1ca8aeaf34a717dffd8f4a1f0333d25c7d1c904
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Nov 15 11:07:55 2021 +0100

    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.

Diff:
---
 gcc/gimple-loop-jam.c                   |  2 +-
 gcc/testsuite/gcc.dg/torture/pr103219.c | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/gcc/gimple-loop-jam.c b/gcc/gimple-loop-jam.c
index 611d3805304..666f740f86d 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 00000000000..cb9023ed8b6
--- /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;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-15 10:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 10:10 [gcc r12-5264] tree-optimization/103219 - avoid ICE in unroll-and-jam Richard Biener

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).