public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1972] tree-optimization/106533 - loop distribution of inner loop of nest Date: Fri, 5 Aug 2022 10:12:06 +0000 (GMT) [thread overview] Message-ID: <20220805101206.635273858C53@sourceware.org> (raw) https://gcc.gnu.org/g:36bc2a8f24f9c8f6eb2c579d520d7fc73a113ae1 commit r13-1972-g36bc2a8f24f9c8f6eb2c579d520d7fc73a113ae1 Author: Richard Biener <rguenther@suse.de> Date: Fri Aug 5 10:40:18 2022 +0200 tree-optimization/106533 - loop distribution of inner loop of nest Loop distribution currently gives up if the outer loop of a loop nest it analyzes contains a stmt with side-effects instead of continuing to analyze the innermost loop. The following fixes that by continuing anyway. PR tree-optimization/106533 * tree-loop-distribution.cc (loop_distribution::execute): Continue analyzing the inner loops when find_seed_stmts_for_distribution fails. * gcc.dg/tree-ssa/ldist-39.c: New testcase. Diff: --- gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c | 16 ++++++++++++++++ gcc/tree-loop-distribution.cc | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c new file mode 100644 index 00000000000..3ef72864d96 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c @@ -0,0 +1,16 @@ +/* PR/106533 */ +/* { dg-options "-O2 -fdump-tree-ldist-optimized" } */ + +void bar (int *a, int * __restrict b) +{ + for (int k = 0; k < 10; k++) + { + for (int j = 0; j < 100000; ++j) + a[j] = b[j]; + __builtin_printf ("Foo!"); + } +} + +/* The stmt with side-effects in the outer loop should not prevent + distribution of the inner loop of the loop nest. */ +/* { dg-final { scan-tree-dump "optimized: Loop . distributed: split to 0 loops and 1 library calls" "ldist" } } */ diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc index 0ee441c077d..e1948fb452a 100644 --- a/gcc/tree-loop-distribution.cc +++ b/gcc/tree-loop-distribution.cc @@ -3829,7 +3829,7 @@ loop_distribution::execute (function *fun) { auto_vec<gimple *> work_list; if (!find_seed_stmts_for_distribution (loop, &work_list)) - break; + continue; const char *str = loop->inner ? " nest" : ""; dump_user_location_t loc = find_loop_location (loop);
reply other threads:[~2022-08-05 10:12 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=20220805101206.635273858C53@sourceware.org \ --to=rguenth@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).