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-5300] tree-optimization/108482 - remove stray .LOOP_DIST_ALIAS calls
Date: Mon, 23 Jan 2023 10:51:27 +0000 (GMT)	[thread overview]
Message-ID: <20230123105127.A306D3858414@sourceware.org> (raw)

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

commit r13-5300-gad4f8c4e375dd7603382ed3ff95bd184e1959918
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Jan 23 10:22:38 2023 +0100

    tree-optimization/108482 - remove stray .LOOP_DIST_ALIAS calls
    
    The following deals with .LOOP_DIST_ALIAS surviving vectorization
    because any of the loops involved were elided between loop distribution
    and vectorization.  As opposed to .LOOP_VECTORIZED which exists only
    between if-conversion and vectorization with no intermediate passes
    this is more difficult to deal with in advance and thus cleaning
    up after vectorization looks better.  There's the unconditional
    vector lowering pass which looks like a good place for this (for
    SIMD uid we have pass_simduid_cleanup).
    
            PR tree-optimization/108482
            * tree-vect-generic.cc (expand_vector_operations): Fold remaining
            .LOOP_DIST_ALIAS calls.
    
            * gcc.dg/torture/pr108482.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.dg/torture/pr108482.c | 18 ++++++++++++++++++
 gcc/tree-vect-generic.cc                |  8 ++++++++
 2 files changed, 26 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/torture/pr108482.c b/gcc/testsuite/gcc.dg/torture/pr108482.c
new file mode 100644
index 00000000000..8dc1169a9c5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr108482.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+int g_30, g_261, g_263, func_1___trans_tmp_17;
+int **g_120;
+int *g_530;
+void func_1() {
+  int *l_29 = &g_30;
+  *l_29 = 1;
+  g_263 = 0;
+  for (; g_263 <= 1; g_263 += 1) {
+    g_530 = 0;
+    if (*l_29) {
+      char *l_1694 = (char *)&g_261;
+      *l_1694 &= **g_120;
+    } else
+      *l_29 ^= func_1___trans_tmp_17;
+  }
+}
diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc
index 2e2d7567293..166a248f4b9 100644
--- a/gcc/tree-vect-generic.cc
+++ b/gcc/tree-vect-generic.cc
@@ -2398,6 +2398,14 @@ expand_vector_operations (void)
 	  if (maybe_clean_eh_stmt (gsi_stmt (gsi))
 	      && gimple_purge_dead_eh_edges (bb))
 	    cfg_changed = true;
+	  /* If a .LOOP_DIST_ALIAS call prevailed loops got elided
+	     before vectorization got a chance to get at them.  Simply
+	     fold as if loop distribution wasn't performed.  */
+	  if (gimple_call_internal_p (gsi_stmt (gsi), IFN_LOOP_DIST_ALIAS))
+	    {
+	      fold_loop_internal_call (gsi_stmt (gsi), boolean_false_node);
+	      cfg_changed = true;
+	    }
 	}
     }

                 reply	other threads:[~2023-01-23 10: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=20230123105127.A306D3858414@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: 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).