]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/90756 (g++ ICE in convert_move, at expr.c:218 on...
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 12:48:18 +0000 (14:48 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 12:48:18 +0000 (14:48 +0200)
Backported from mainline
2019-07-04  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/90756
* explow.c (promote_ssa_mode): Always use TYPE_MODE, don't bypass it
for VECTOR_TYPE_P.

* gcc.dg/pr90756.c: New test.

From-SVN: r275162

gcc/ChangeLog
gcc/explow.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr90756.c [new file with mode: 0644]

index f8a16fc2c99b021b72ebb936d1179edd64a61564..8de4dd60beec06d69f520f65d163121185ed0ddd 100644 (file)
@@ -1,6 +1,12 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-07-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/90756
+       * explow.c (promote_ssa_mode): Always use TYPE_MODE, don't bypass it
+       for VECTOR_TYPE_P.
+
        2019-06-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/90760
index 67cb6ff1513b113d4e5eee01396340340c3ddd48..76f65fc82c1e5e34011bd3da7513a393ae940cb5 100644 (file)
@@ -872,16 +872,7 @@ promote_ssa_mode (const_tree name, int *punsignedp)
 
   tree type = TREE_TYPE (name);
   int unsignedp = TYPE_UNSIGNED (type);
-  machine_mode mode = TYPE_MODE (type);
-
-  /* Bypass TYPE_MODE when it maps vector modes to BLKmode.  */
-  if (mode == BLKmode)
-    {
-      gcc_assert (VECTOR_TYPE_P (type));
-      mode = type->type_common.mode;
-    }
-
-  machine_mode pmode = promote_mode (type, mode, &unsignedp);
+  machine_mode pmode = promote_mode (type, TYPE_MODE (type), &unsignedp);
   if (punsignedp)
     *punsignedp = unsignedp;
 
index 3d0337202023d5428a72bc4ba1b2c674b021b6e3..48caf134dea48f77c6bedf3dbc07673aafdb340f 100644 (file)
@@ -1,6 +1,11 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-07-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/90756
+       * gcc.dg/pr90756.c: New test.
+
        2019-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/90954
diff --git a/gcc/testsuite/gcc.dg/pr90756.c b/gcc/testsuite/gcc.dg/pr90756.c
new file mode 100644 (file)
index 0000000..3507aa2
--- /dev/null
@@ -0,0 +1,26 @@
+/* PR rtl-optimization/90756 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wno-psabi" } */
+/* { dg-additional-options "-mno-sse" { target ia32 } } */
+
+typedef float B __attribute__((vector_size(4 * sizeof (float))));
+typedef unsigned long long C __attribute__((vector_size(4 * sizeof (long long))));
+typedef short D __attribute__((vector_size(4 * sizeof (short))));
+B z;
+void foo (C);
+C bar (D);
+B baz ();
+D qux (B);
+
+void
+quux (int x)
+{
+  B n = z, b = z;
+  while (1)
+    switch (x)
+      {
+      case 0: n = baz (); /* FALLTHRU */
+      case 1: { B o = n; n = b; b = o; } /* FALLTHRU */
+      case 2: { D u = qux (b); C v = bar (u); foo (v); }
+      }
+}