public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-275] isel: Fix up gimple_expand_vec_set_expr [PR105528]
@ 2022-05-10 16:34 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-05-10 16:34 UTC (permalink / raw)
  To: gcc-cvs

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

commit r13-275-gddd46293e2b508b260eefe1adbad6720df7a5dd2
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue May 10 18:34:08 2022 +0200

    isel: Fix up gimple_expand_vec_set_expr [PR105528]
    
    The following testcase ICEs (and only without -g), because we don't replace
    one VEC_COND_EXPR with .VCOND* call.
    We don't do that because gimple_expand_vec_set_expr adds some stmts before
    *gsi and then uses gsi_remove to remove it.  gsi_remove moves the iterator
    to the next stmt and in the caller we then do gsi_next before looking at
    another stmt, which means we can skip processing of one stmt, which in this
    case happened to be a VEC_COND_EXPR but with -g is some debug stmt in
    between.  As we always emit some stmts before it, it is easy to update the
    iterator to the last stmt emitted there, so that caller continues really
    with the next stmt.
    
    2022-05-10  Jakub Jelinek  <jakub@redhat.com>
    
            PR tree-optimization/105528
            * gimple-isel.cc (gimple_expand_vec_set_expr): After gsi_remove
            set *gsi to gsi_for_stmt (ass_stmt).  Fix up function comment.
    
            * gcc.dg/pr105528.c: New test.

Diff:
---
 gcc/gimple-isel.cc              |  3 ++-
 gcc/testsuite/gcc.dg/pr105528.c | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/gcc/gimple-isel.cc b/gcc/gimple-isel.cc
index 4b309a05a9a..44d086d8b28 100644
--- a/gcc/gimple-isel.cc
+++ b/gcc/gimple-isel.cc
@@ -43,7 +43,7 @@ along with GCC; see the file COPYING3.  If not see
 /* Expand all ARRAY_REF(VIEW_CONVERT_EXPR) gimple assignments into calls to
    internal function based on vector type of selected expansion.
    i.e.:
-     VIEW_CONVERT_EXPR<int[4]>(u)[_1] =  = i_4(D);
+     VIEW_CONVERT_EXPR<int[4]>(u)[_1] = i_4(D);
    =>
      _7 = u;
      _8 = .VEC_SET (_7, i_4(D), _1);
@@ -104,6 +104,7 @@ gimple_expand_vec_set_expr (struct function *fun, gimple_stmt_iterator *gsi)
 	  if (gsi_remove (gsi, true)
 	      && gimple_purge_dead_eh_edges (bb))
 	    cfg_changed = true;
+	  *gsi = gsi_for_stmt (ass_stmt);
 	}
     }
 
diff --git a/gcc/testsuite/gcc.dg/pr105528.c b/gcc/testsuite/gcc.dg/pr105528.c
new file mode 100644
index 00000000000..e380d56ee06
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr105528.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/105528 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wno-psabi -fcompare-debug" } */
+/* { dg-additional-options "-mavx512f" { target i?86-*-* x86_64-*-* } } */
+
+typedef unsigned V __attribute__((__vector_size__ (64)));
+V g;
+
+V
+bar (V v)
+{
+  V w;
+  v <<= (V){(V){}[53]} >= v & 5;
+  w[w[5]] -= ~0;
+  v %= ~0;
+  return v + w;
+}
+
+void
+foo (void)
+{
+  g -= (V){bar((V){~0})[3]};
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-10 16:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 16:34 [gcc r13-275] isel: Fix up gimple_expand_vec_set_expr [PR105528] Jakub Jelinek

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).