Hi!

We use SSA_NAMEs even for vector types which have BLKmode, e.g. neither x86
nor sparc targets have V1SFmode and thus such VECTOR_TYPEs have BLKmode.
In some cases outof ssa subpass calls get_temp_reg, but that will
gen_reg_rtx (BLKmode) in that case, which is something that doesn't really
work.  The following patch fixes it by using a stack slot for the BLKmode
SSA_NAMEs instead.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2019-04-19  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/90139
        * tree-outof-ssa.c (get_temp_reg): If reg_mode is BLKmode, return
        assign_temp instead of gen_reg_rtx.

        * gcc.c-torture/compile/pr90139.c: New test.

--- gcc/tree-outof-ssa.c.jj     2019-03-19 07:46:45.136798336 +0100
+++ gcc/tree-outof-ssa.c        2019-04-18 15:40:33.801698542 +0200
@@ -653,6 +653,8 @@ get_temp_reg (tree name)
   tree type = TREE_TYPE (name);
   int unsignedp;
   machine_mode reg_mode = promote_ssa_mode (name, &unsignedp);
+  if (reg_mode == BLKmode)
+    return assign_temp (type, 0, 0);
   rtx x = gen_reg_rtx (reg_mode);
   if (POINTER_TYPE_P (type))
     mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (type)));
--- gcc/testsuite/gcc.c-torture/compile/pr90139.c.jj    2019-04-18 
15:39:16.121974160 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr90139.c       2019-04-18 
15:37:08.947062569 +0200
@@ -0,0 +1,20 @@
+/* PR middle-end/90139 */
+
+typedef float __attribute__((vector_size (sizeof (float)))) V;
+void bar (int, V *);
+int l;
+
+void
+foo (void)
+{
+  V n, b, o;
+  while (1)
+    switch (l)
+      {
+      case 0:
+       o = n;
+       n = b;
+       b = o;
+       bar (1, &o);
+      }
+}

        Jakub

Reply via email to