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 r10-10543] tree-optimization/105226 - avoid splitting abnormal edges Date: Thu, 21 Apr 2022 12:51:32 +0000 (GMT) [thread overview] Message-ID: <20220421125132.CC708380DBD1@sourceware.org> (raw) https://gcc.gnu.org/g:813b14ede7207555e65e6ce976ff0c04ab2b7875 commit r10-10543-g813b14ede7207555e65e6ce976ff0c04ab2b7875 Author: Richard Biener <rguenther@suse.de> Date: Tue Apr 12 09:40:15 2022 +0200 tree-optimization/105226 - avoid splitting abnormal edges Vectorizer loop versioning tries to version outer loops if possible but fails to check whether it can actually split the single exit edge as it will do. 2022-04-12 Richard Biener <rguenther@suse.de> PR tree-optimization/105226 * tree-vect-loop-manip.c (vect_loop_versioning): Verify we can split the exit of an outer loop we choose to version. * gcc.dg/pr105226.c: New testcase. (cherry picked from commit 62d5bb0f35fb6ec373eaac942755585a633528a0) Diff: --- gcc/testsuite/gcc.dg/pr105226.c | 23 +++++++++++++++++++++++ gcc/tree-vect-loop-manip.c | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/pr105226.c b/gcc/testsuite/gcc.dg/pr105226.c new file mode 100644 index 00000000000..9c4941dc6fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105226.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ +/* { dg-require-effective-target indirect_jumps } */ + +#include <setjmp.h> +struct longjmp_buf { + jmp_buf buf; +}; +void g (); +void f () +{ + int i, n; + long *a; + long *args; + struct longjmp_buf b; + setjmp (b.buf); + for (;;) + { + for (i = 0; i < n; i++) + a[i] = args[i]; + g (); + } +} diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 639d8ceabf0..046e131e837 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -3384,7 +3384,8 @@ vect_loop_versioning (loop_vec_info loop_vinfo, outermost = superloop_at_depth (loop, 1); /* And avoid applying versioning on non-perfect nests. */ while (loop_to_version != outermost - && single_exit (loop_outer (loop_to_version)) + && (e = single_exit (loop_outer (loop_to_version))) + && !(e->flags & EDGE_COMPLEX) && (!loop_outer (loop_to_version)->inner->next || vect_loop_vectorized_call (loop_to_version)) && (!loop_outer (loop_to_version)->inner->next
reply other threads:[~2022-04-21 12:51 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=20220421125132.CC708380DBD1@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).