This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR target/71801: Don't convert TImode in debug insn


When converting V1TImode register in debug insn, check if it has been
converted to TImode already.

Tested on x86-64.  OK for trunk?

H.J.
---
gcc/

	PR target/71801
	* config/i386/i386.c (timode_scalar_chain::fix_debug_reg_uses):
	Don't convert TImode in debug insn.

gcc/testsuite/

	PR target/71801
	* gcc.target/i386/pr71801.c: New test.
---
 gcc/config/i386/i386.c                  |  3 +++
 gcc/testsuite/gcc.target/i386/pr71801.c | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr71801.c

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 9eaf414..d190bef 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3814,6 +3814,9 @@ timode_scalar_chain::fix_debug_reg_uses (rtx reg)
 	    continue;
 	  gcc_assert (GET_CODE (val) == VAR_LOCATION);
 	  rtx loc = PAT_VAR_LOCATION_LOC (val);
+	  /* It may have been converted to TImode already.  */
+	  if (GET_MODE (loc) == TImode)
+	    continue;
 	  gcc_assert (REG_P (loc)
 		      && GET_MODE (loc) == V1TImode);
 	  /* Convert V1TImode register, which has been updated by a SET
diff --git a/gcc/testsuite/gcc.target/i386/pr71801.c b/gcc/testsuite/gcc.target/i386/pr71801.c
new file mode 100644
index 0000000..6c87522
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr71801.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+struct {
+  char uuid[16];
+} c;
+struct {
+  int s_uuid[6];
+} a, b;
+int bar (void);
+static int get_label_uuid(char *p1) {
+  __builtin_memcpy(p1, a.s_uuid, sizeof(a));
+  if (bar())
+    __builtin_memcpy(p1, b.s_uuid, sizeof(b));
+  return 0;
+}
+void uuidcache_addentry(char *p1) { __builtin_memcpy(&c, p1, sizeof(c)); }
+void uuidcache_init() {
+  char d[1];
+  get_label_uuid(d);
+  uuidcache_addentry(d);
+}
-- 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]