public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r9-9398] debug: Fix another vector DECL_MODE ICE [PR98100]
Date: Tue, 20 Apr 2021 23:30:32 +0000 (GMT)	[thread overview]
Message-ID: <20210420233032.054893AA7C93@sourceware.org> (raw)

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

commit r9-9398-gc47d4bddf3b08f833b2a59cc0be40234fe10e6bc
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Dec 4 12:18:21 2020 +0100

    debug: Fix another vector DECL_MODE ICE [PR98100]
    
    The PR88587 fix changes DECL_MODE of vars with vector type during inlining/cloning
    when the vars are copied, so that their DECL_MODE matches their TYPE_MODE in
    the new function.  Unfortunately, the following testcase still ICEs, the var
    isn't really used in the new function and so it isn't copied, but becomes
    just a nonlocalized var.  So we can't adjust its DECL_MODE because it
    appears in multiple functions and needs different modes in between them.
    The following patch changes the DEBUG_INSN creation to use TYPE_MODE instead
    of DECL_MODE for vars with vector types.
    
    2020-12-04  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/98100
            * cfgexpand.c (expand_gimple_basic_block): For vars with
            vector type, use TYPE_MODE rather than DECL_MODE.
    
            * gcc.target/i386/pr98100.c: New test.
    
    (cherry picked from commit 4c18faa4dd4dffdb76bc879b7555574ce3f4da01)

Diff:
---
 gcc/cfgexpand.c                         | 7 +++++--
 gcc/testsuite/gcc.target/i386/pr98100.c | 9 +++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 1b0591193c3..26b6bf3e6c6 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -5773,7 +5773,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
 			  && !target_for_debug_bind (var))
 			goto delink_debug_stmt;
 
-		      if (DECL_P (var))
+		      if (DECL_P (var) && !VECTOR_TYPE_P (TREE_TYPE (var)))
 			mode = DECL_MODE (var);
 		      else
 			mode = TYPE_MODE (TREE_TYPE (var));
@@ -5790,7 +5790,10 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
 
 		      value = gimple_debug_source_bind_get_value (stmt);
 
-		      mode = DECL_MODE (var);
+		      if (!VECTOR_TYPE_P (TREE_TYPE (var)))
+			mode = DECL_MODE (var);
+		      else
+			mode = TYPE_MODE (TREE_TYPE (var));
 
 		      val = gen_rtx_VAR_LOCATION (mode, var, (rtx)value,
 						  VAR_INIT_STATUS_UNINITIALIZED);
diff --git a/gcc/testsuite/gcc.target/i386/pr98100.c b/gcc/testsuite/gcc.target/i386/pr98100.c
new file mode 100644
index 00000000000..4deda1a498f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98100.c
@@ -0,0 +1,9 @@
+/* PR target/98100 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-avx -fvar-tracking-assignments -g0" } */
+
+__attribute__((target_clones("default","avx2"))) void
+foo ()
+{
+  __attribute__((__vector_size__(8 * sizeof(int)))) int b = {};
+}


                 reply	other threads:[~2021-04-20 23:30 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=20210420233032.054893AA7C93@sourceware.org \
    --to=jakub@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).