public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, committed] rs6000: Skip debug insns for union [PR105627]
@ 2022-05-24  6:13 Kewen.Lin
  0 siblings, 0 replies; only message in thread
From: Kewen.Lin @ 2022-05-24  6:13 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, David Edelsohn

Hi,

Bootstrapped and regress-tested on powerpc64-linux-gnu P8 and
powerpc64le-linux-gnu P8, P9 and P10.

Pushed this as r13-720-g149d04ccbb908b3a251485b43faf204752942b9f.

---
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.
---
 gcc/config/rs6000/rs6000-p8swap.cc          | 10 ++++----
 gcc/testsuite/gcc.target/powerpc/pr105627.c | 26 +++++++++++++++++++++
 2 files changed, 32 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/pr105627.c

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;
+}
+
--
2.27.0

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

only message in thread, other threads:[~2022-05-24  6:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24  6:13 [PATCH, committed] rs6000: Skip debug insns for union [PR105627] Kewen.Lin

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