PR middle-end/28915
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 Nov 2006 08:16:11 +0000 (08:16 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 Nov 2006 08:16:11 +0000 (08:16 +0000)
        * gimplify.c (gimplify_init_constructor): Don't reduce TREE_CONSTANT
        vector ctors.
        * tree-cfg.c (verify_expr): Don't look into TREE_CONSTANT
        vector ctors.
        * expmed.c (make_tree): Handle CONST, SYMBOL_REF.
        * tree.c (build_vector): Handle non-_CST elements.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118747 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/expmed.c
gcc/gimplify.c
gcc/testsuite/gcc.target/i386/vectorize1.c [new file with mode: 0644]
gcc/tree-cfg.c
gcc/tree.c

index 6865d82..1cab5ef 100644 (file)
@@ -1,3 +1,14 @@
+2006-11-12  Jason Merrill  <jason@redhat.com>
+           Andrew Pinski <pinskia@physics.uc.edu>
+
+       PR middle-end/28915
+       * gimplify.c (gimplify_init_constructor): Don't reduce TREE_CONSTANT
+       vector ctors.
+       * tree-cfg.c (verify_expr): Don't look into TREE_CONSTANT
+       vector ctors.
+       * expmed.c (make_tree): Handle CONST, SYMBOL_REF.
+       * tree.c (build_vector): Handle non-_CST elements.
+
 2006-11-12  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * genemit.c (gen_insn): Call gen_exp with a non-null used
index b044780..6a0d353 100644 (file)
@@ -5044,6 +5044,15 @@ make_tree (tree type, rtx x)
                                          GET_CODE (x) == ZERO_EXTEND);
       return fold_convert (type, make_tree (t, XEXP (x, 0)));
 
+    case CONST:
+      return make_tree (type, XEXP (x, 0));
+
+    case SYMBOL_REF:
+      t = SYMBOL_REF_DECL (x);
+      if (t)
+       return fold_convert (type, build_fold_addr_expr (t));
+      /* else fall through.  */
+
     default:
       t = build_decl (VAR_DECL, NULL_TREE, type);
 
index 4e5d609..13c5f48 100644 (file)
@@ -3161,6 +3161,11 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
                TREE_OPERAND (*expr_p, 1) = build_vector_from_ctor (type, elts);
                break;
              }
+
+           /* Don't reduce a TREE_CONSTANT vector ctor even if we can't
+              make a VECTOR_CST.  It won't do anything for us, and it'll
+              prevent us from representing it as a single constant.  */
+           break;
          }
 
        /* Vector types use CONSTRUCTOR all the way through gimple
diff --git a/gcc/testsuite/gcc.target/i386/vectorize1.c b/gcc/testsuite/gcc.target/i386/vectorize1.c
new file mode 100644 (file)
index 0000000..28994bd
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR middle-end/28915 */
+/* { dg-options "-msse -O2 -ftree-vectorize -fdump-tree-vect" } */
+
+extern char lanip[3][40];
+typedef struct
+{
+  char *t[4];
+}tx_typ;
+
+int set_names (void)
+{
+  static tx_typ tt1;
+  int ln;
+  for (ln = 0; ln < 4; ln++)
+      tt1.t[ln] = lanip[1];
+}
+
+/* { dg-final { scan-tree-dump "vect_cst" "vect" } } */
index 7c397aa..fc30f22 100644 (file)
@@ -3420,6 +3420,11 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
       CHECK_OP (1, "invalid operand to binary operator");
       break;
 
+    case CONSTRUCTOR:
+      if (TREE_CONSTANT (t) && TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+       *walk_subtrees = 0;
+      break;
+
     default:
       break;
     }
index 92b25e3..6e3d13b 100644 (file)
@@ -973,6 +973,10 @@ build_vector (tree type, tree vals)
     {
       tree value = TREE_VALUE (link);
 
+      /* Don't crash if we get an address constant.  */
+      if (!CONSTANT_CLASS_P (value))
+       continue;
+
       over1 |= TREE_OVERFLOW (value);
       over2 |= TREE_CONSTANT_OVERFLOW (value);
     }