--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef int v4si __attribute__((vector_size (sizeof(int) * 4)));
+
+v4si x;
+
+void foo (int flag)
+{
+ v4si tem = (v4si) { 0, 0, 0, 0 };
+ if (flag)
+ tem = (v4si) { flag };
+ x = __builtin_shufflevector (tem, tem, 0, 0, 0, 0);
+}
tree
vn_nary_simplify (vn_nary_op_t nary)
{
- if (nary->length > gimple_match_op::MAX_NUM_OPS)
+ if (nary->length > gimple_match_op::MAX_NUM_OPS
+ /* For CONSTRUCTOR the vn_nary_op_t and gimple_match_op representation
+ does not match. */
+ || nary->opcode == CONSTRUCTOR)
return NULL_TREE;
gimple_match_op op (gimple_match_cond::UNCOND, nary->opcode,
nary->type, nary->length);
memcpy (op.ops, nary->op, sizeof (tree) * nary->length);
tree res = vn_nary_build_or_lookup_1 (&op, false, true);
- if (op.code.is_tree_code () && op.num_ops <= nary->length)
+ if (op.code.is_tree_code ()
+ && op.num_ops <= nary->length
+ && (tree_code) op.code != CONSTRUCTOR)
{
nary->opcode = (tree_code) op.code;
nary->length = op.num_ops;