public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kewen Lin <linkw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-720] rs6000: Skip debug insns for union [PR105627]
Date: Tue, 24 May 2022 06:08:57 +0000 (GMT)	[thread overview]
Message-ID: <20220524060857.77AB93856DEC@sourceware.org> (raw)

https://gcc.gnu.org/g:149d04ccbb908b3a251485b43faf204752942b9f

commit r13-720-g149d04ccbb908b3a251485b43faf204752942b9f
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue May 24 01:00:22 2022 -0500

    rs6000: Skip debug insns for union [PR105627]
    
    As PR105627 exposes, pass analyze_swaps should skip debug
    insn when doing unionfind_union.  One debug insn can use
    several pseudos, if we take debug insn into account, we can
    union those insns defining them and generate some unexpected
    unions.
    
    Based on the assumption that it's impossible to have one
    pseudo which is defined by one debug insn but is used by one
    nondebug insn, we just asserts debug insn never shows up in
    function union_defs.
    
            PR target/105627
    
    gcc/ChangeLog:
    
            * config/rs6000/rs6000-p8swap.cc (union_defs): Assert def_insn can't
            be a debug insn.
            (union_uses): Skip debug use_insn.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/powerpc/pr105627.c: New test.

Diff:
---
 gcc/config/rs6000/rs6000-p8swap.cc          | 10 ++++++----
 gcc/testsuite/gcc.target/powerpc/pr105627.c | 26 ++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-p8swap.cc b/gcc/config/rs6000/rs6000-p8swap.cc
index d301bc3fe59..275702fee1b 100644
--- a/gcc/config/rs6000/rs6000-p8swap.cc
+++ b/gcc/config/rs6000/rs6000-p8swap.cc
@@ -214,8 +214,9 @@ union_defs (swap_web_entry *insn_entry, rtx insn, df_ref use)
       if (DF_REF_INSN_INFO (link->ref))
 	{
 	  rtx def_insn = DF_REF_INSN (link->ref);
-	  (void)unionfind_union (insn_entry + INSN_UID (insn),
-				 insn_entry + INSN_UID (def_insn));
+	  gcc_assert (NONDEBUG_INSN_P (def_insn));
+	  unionfind_union (insn_entry + INSN_UID (insn),
+			   insn_entry + INSN_UID (def_insn));
 	}
 
       link = link->next;
@@ -242,8 +243,9 @@ union_uses (swap_web_entry *insn_entry, rtx insn, df_ref def)
       if (DF_REF_INSN_INFO (link->ref))
 	{
 	  rtx use_insn = DF_REF_INSN (link->ref);
-	  (void)unionfind_union (insn_entry + INSN_UID (insn),
-				 insn_entry + INSN_UID (use_insn));
+	  if (NONDEBUG_INSN_P (use_insn))
+	    unionfind_union (insn_entry + INSN_UID (insn),
+			     insn_entry + INSN_UID (use_insn));
 	}
 
       link = link->next;
diff --git a/gcc/testsuite/gcc.target/powerpc/pr105627.c b/gcc/testsuite/gcc.target/powerpc/pr105627.c
new file mode 100644
index 00000000000..bafb31ff061
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr105627.c
@@ -0,0 +1,26 @@
+/* Specify -w to disable some warnings, such as: -Wpsabi.  */
+/* { dg-options "-Og -fcompare-debug -mdejagnu-cpu=power8 -w" } */
+
+typedef unsigned char __attribute__ ((__vector_size__ (8))) U;
+typedef unsigned char __attribute__ ((__vector_size__ (64))) V;
+
+U u;
+char c;
+V v;
+
+V
+foo (void)
+{
+  V w = c
+	& __builtin_shufflevector (u, (V){0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+					  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+					  0, 0, 0, 0, 0, 0, 0, 5},
+				   24, 24, 41, 45, 53, 60, 22, 35, 45, 12, 61,
+				   9, 52, 15, 44, 46, 5, 5, 1, 0, 4, 9, 0, 8, 5,
+				   7, 2, 5, 9, 2, 7, 7, 5, 6, 0, 2, 6, 1, 7, 7,
+				   0, 4, 0, 1, 7, 2, 5, 3, 2, 3, 5, 6, 6, 6, 0,
+				   6, 1, 9, 0, 5, 4, 3, 5, 4);
+  w = w + v;
+  return w;
+}
+


                 reply	other threads:[~2022-05-24  6:08 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=20220524060857.77AB93856DEC@sourceware.org \
    --to=linkw@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).