From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/107865 - ICE with outlining of loops
Date: Fri, 25 Nov 2022 08:59:20 +0100 (CET) [thread overview]
Message-ID: <20221125075921.0706813A08@imap2.suse-dmz.suse.de> (raw)
The following makes sure to clear loops number of iterations when
outlining them as part of a SESE region as can happen with
auto-parallelization. The referenced SSA names become stale otherwise.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
PR tree-optimization/107865
* tree-cfg.cc (move_sese_region_to_fn): Free the number of
iterations of moved loops.
* gfortran.dg/graphite/pr107865.f90: New testcase.
---
.../gfortran.dg/graphite/pr107865.f90 | 18 ++++++++++++++++++
gcc/tree-cfg.cc | 2 ++
2 files changed, 20 insertions(+)
create mode 100644 gcc/testsuite/gfortran.dg/graphite/pr107865.f90
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr107865.f90 b/gcc/testsuite/gfortran.dg/graphite/pr107865.f90
new file mode 100644
index 00000000000..6bddb17a1be
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/pr107865.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-options "-O1 -floop-parallelize-all -ftree-parallelize-loops=2" }
+
+ SUBROUTINE FNC (F)
+
+ IMPLICIT REAL (A-H)
+ DIMENSION F(N)
+
+ DO I = 1, 6
+ DO J = 1, 6
+ IF (J .NE. I) THEN
+ F(I) = F(I) + 1
+ END IF
+ END DO
+ END DO
+
+ RETURN
+ END
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index 28175312afc..0c409b435fb 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -7859,6 +7859,8 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
if (bb->loop_father->header == bb)
{
class loop *this_loop = bb->loop_father;
+ /* Avoid the need to remap SSA names used in nb_iterations. */
+ free_numbers_of_iterations_estimates (this_loop);
class loop *outer = loop_outer (this_loop);
if (outer == loop
/* If the SESE region contains some bbs ending with
--
2.35.3
reply other threads:[~2022-11-25 7:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221125075921.0706813A08@imap2.suse-dmz.suse.de \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).