aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-12-02 09:44:42 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-12-02 09:44:42 +0100
commit60ebe8ce1d029cbff8ef80c967f98ba43d746f3b (patch)
treed0c90b780983a3a4c1d8282028a2bf718f76ca35
parenta717444986a981b21b42fccfd982dcb6ebe42254 (diff)
downloadgcc-60ebe8ce1d029cbff8ef80c967f98ba43d746f3b.zip
gcc-60ebe8ce1d029cbff8ef80c967f98ba43d746f3b.tar.gz
gcc-60ebe8ce1d029cbff8ef80c967f98ba43d746f3b.tar.bz2
re PR rtl-optimization/78547 (ICE: in loc_cmp, at var-tracking.c:3417 with -Os -g -mstringop-strategy=libcall -freorder-blocks-algorithm=simple)
PR rtl-optimization/78547 * emit-rtl.c (unshare_all_rtl): Make sure DECL_RTL and DECL_INCOMING_RTL is not shared. * config/i386/i386.c (convert_scalars_to_vectors): If any insns have been converted, adjust all parameter's DEC_RTL and DECL_INCOMING_RTL back from V1TImode to TImode if the parameters have TImode. * gcc.dg/pr78547.c: New test. From-SVN: r243165
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/i386.c22
-rw-r--r--gcc/emit-rtl.c8
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.dg/pr78547.c18
5 files changed, 59 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a83f528..260a66d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2016-12-02 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/78547
+ * emit-rtl.c (unshare_all_rtl): Make sure DECL_RTL and
+ DECL_INCOMING_RTL is not shared.
+ * config/i386/i386.c (convert_scalars_to_vectors): If any
+ insns have been converted, adjust all parameter's DEC_RTL and
+ DECL_INCOMING_RTL back from V1TImode to TImode if the parameters have
+ TImode.
+
PR rtl-optimization/78575
* config/i386/i386.c (timode_scalar_chain::fix_debug_reg_uses): Use
DF infrastructure to wrap all V1TImode reg uses into TImode subreg
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5226e454..5678fa2 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4075,6 +4075,28 @@ convert_scalars_to_vector ()
crtl->stack_alignment_needed = 128;
if (crtl->stack_alignment_estimated < 128)
crtl->stack_alignment_estimated = 128;
+ /* Fix up DECL_RTL/DECL_INCOMING_RTL of arguments. */
+ if (TARGET_64BIT)
+ for (tree parm = DECL_ARGUMENTS (current_function_decl);
+ parm; parm = DECL_CHAIN (parm))
+ {
+ if (TYPE_MODE (TREE_TYPE (parm)) != TImode)
+ continue;
+ if (DECL_RTL_SET_P (parm)
+ && GET_MODE (DECL_RTL (parm)) == V1TImode)
+ {
+ rtx r = DECL_RTL (parm);
+ if (REG_P (r))
+ SET_DECL_RTL (parm, gen_rtx_SUBREG (TImode, r, 0));
+ }
+ if (DECL_INCOMING_RTL (parm)
+ && GET_MODE (DECL_INCOMING_RTL (parm)) == V1TImode)
+ {
+ rtx r = DECL_INCOMING_RTL (parm);
+ if (REG_P (r))
+ DECL_INCOMING_RTL (parm) = gen_rtx_SUBREG (TImode, r, 0);
+ }
+ }
}
return 0;
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 02512d3..d2ac88b 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2668,6 +2668,14 @@ unsigned int
unshare_all_rtl (void)
{
unshare_all_rtl_1 (get_insns ());
+
+ for (tree decl = DECL_ARGUMENTS (cfun->decl); decl; decl = DECL_CHAIN (decl))
+ {
+ if (DECL_RTL_SET_P (decl))
+ SET_DECL_RTL (decl, copy_rtx_if_shared (DECL_RTL (decl)));
+ DECL_INCOMING_RTL (decl) = copy_rtx_if_shared (DECL_INCOMING_RTL (decl));
+ }
+
return 0;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6ee4b13..490d081 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2016-12-02 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/78547
+ * gcc.dg/pr78547.c: New test.
+
PR rtl-optimization/78575
* gcc.dg/pr78575.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr78547.c b/gcc/testsuite/gcc.dg/pr78547.c
new file mode 100644
index 0000000..9300cbc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr78547.c
@@ -0,0 +1,18 @@
+/* PR rtl-optimization/78547 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-Os -g -freorder-blocks-algorithm=simple -Wno-psabi" } */
+/* { dg-additional-options "-mstringop-strategy=libcall" { target i?86-*-* x86_64-*-* } } */
+
+typedef unsigned __int128 u128;
+typedef unsigned __int128 V __attribute__ ((vector_size (64)));
+
+V
+foo (u128 a, u128 b, u128 c, V d)
+{
+ V e = (V) {a};
+ V f = e & 1;
+ e = 0 != e;
+ c = c;
+ f = f << ((V) {c} & 7);
+ return f + e;
+}