public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7372] tree-optimization/104676 - free nb_iterations after loop distribution
@ 2022-02-24 14:58 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-02-24 14:58 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a4066d3a5097333f17c0d7be1630a98f3a5b1c1d
commit r12-7372-ga4066d3a5097333f17c0d7be1630a98f3a5b1c1d
Author: Richard Biener <rguenther@suse.de>
Date: Thu Feb 24 14:34:52 2022 +0100
tree-optimization/104676 - free nb_iterations after loop distribution
Loop distribution can release SSA names used in nb_iterations, make
sure to release those.
2022-02-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/104676
* tree-loop-distribution.cc (loop_distribution::execute):
Do a full scev_reset.
* gcc.dg/torture/pr104676.c: New testcase.
Diff:
---
gcc/testsuite/gcc.dg/torture/pr104676.c | 35 +++++++++++++++++++++++++++++++++
gcc/tree-loop-distribution.cc | 2 +-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/gcc.dg/torture/pr104676.c b/gcc/testsuite/gcc.dg/torture/pr104676.c
new file mode 100644
index 00000000000..50845bb9e15
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr104676.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-loop-distribution -ftree-parallelize-loops=2" } */
+
+struct S {
+ int f;
+};
+
+int n;
+
+int
+foo (struct S *s)
+{
+ int arr[3];
+ int v = 0;
+
+ for (n = 0; n < 2; ++n)
+ {
+ int i;
+
+ for (i = 0; i < 2; ++i)
+ {
+ int j;
+
+ for (j = 0; j < s->f; ++j)
+ ++v;
+ }
+
+ if (v)
+ arr[0] = 0;
+
+ arr[n + 1] = 0;
+ }
+
+ return arr[0];
+}
diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc
index c7b42857263..8ee40d88816 100644
--- a/gcc/tree-loop-distribution.cc
+++ b/gcc/tree-loop-distribution.cc
@@ -3853,7 +3853,7 @@ loop_distribution::execute (function *fun)
/* Cached scalar evolutions now may refer to wrong or non-existing
loops. */
- scev_reset_htab ();
+ scev_reset ();
mark_virtual_operands_for_renaming (fun);
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-24 14:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 14:58 [gcc r12-7372] tree-optimization/104676 - free nb_iterations after loop distribution 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).