if (expr *e = dyn_cast <expr *> (op->op))
{
if (e->ops.length () == 0
+ /* In GIMPLE a CONSTRUCTOR always appears in a
+ separate definition. */
&& (!gimple || !(*e->operation == CONSTRUCTOR)))
- generic_exprs.safe_push (op);
+ {
+ generic_exprs.safe_push (op);
+ /* But ADDR_EXPRs can appear directly when invariant
+ and in a separate definition when not. */
+ if (gimple && *e->operation == ADDR_EXPR)
+ gimple_exprs.safe_push (op);
+ }
else if (e->operation->kind == id_base::FN)
{
if (gimple)
if (s->capture_max >= 0)
{
char opname[20];
- fprintf_indent (f, indent, "tree captures[%u] ATTRIBUTE_UNUSED = { %s",
- s->capture_max + 1, indexes[0]->get_name (opname));
+ fprintf_indent (f, indent, "tree captures[%u] ATTRIBUTE_UNUSED = {",
+ s->capture_max + 1);
- for (int i = 1; i <= s->capture_max; ++i)
+ for (int i = 0; i <= s->capture_max; ++i)
{
if (!indexes[i])
break;
- fprintf (f, ", %s", indexes[i]->get_name (opname));
+ const char *opstr = indexes[i]->get_name (opname);
+ expr *e = dyn_cast <expr *> (indexes[i]->op);
+ fputs (i == 0 ? " " : ", ", f);
+ if (e && gimple
+ /* Transparently handle picking up CONSTRUCTOR and ADDR_EXPR
+ leafs if they appear in a separate definition. */
+ && (*e->operation == CONSTRUCTOR
+ || *e->operation == ADDR_EXPR))
+ fprintf (f, "(TREE_CODE (%s) == SSA_NAME "
+ "? gimple_assign_rhs1 (SSA_NAME_DEF_STMT (%s)) : %s)",
+ opstr, opstr, opstr);
+ else
+ fprintf (f, "%s", opstr);
}
fprintf (f, " };\n");
}
(simplify
(view_convert CONSTRUCTOR@0)
(with
- { tree ctor = (TREE_CODE (@0) == SSA_NAME
- ? gimple_assign_rhs1 (SSA_NAME_DEF_STMT (@0)) : @0); }
+ { tree ctor = @0; }
(switch
(if (CONSTRUCTOR_NELTS (ctor) == 0)
{ build_zero_cst (type); })
== tree_to_uhwi (TYPE_SIZE (TREE_TYPE (TREE_TYPE (@0))))))))
(with
{
- tree ctor = (TREE_CODE (@0) == SSA_NAME
- ? gimple_assign_rhs1 (SSA_NAME_DEF_STMT (@0)) : @0);
+ tree ctor = @0;
tree eltype = TREE_TYPE (TREE_TYPE (ctor));
unsigned HOST_WIDE_INT width = tree_to_uhwi (TYPE_SIZE (eltype));
unsigned HOST_WIDE_INT n = tree_to_uhwi (@1);
/* Fold reduction of a single nonzero element constructor. */
(for reduc (IFN_REDUC_PLUS IFN_REDUC_IOR IFN_REDUC_XOR)
(simplify (reduc (CONSTRUCTOR@0))
- (with { tree ctor = (TREE_CODE (@0) == SSA_NAME
- ? gimple_assign_rhs1 (SSA_NAME_DEF_STMT (@0)) : @0);
+ (with { tree ctor = @0;
tree elt = ctor_single_nonzero_element (ctor); }
(if (elt
&& !HONOR_SNANS (type)
(match vec_same_elem_p
CONSTRUCTOR@0
- (if (TREE_CODE (@0) == SSA_NAME
- && uniform_vector_p (gimple_assign_rhs1 (SSA_NAME_DEF_STMT (@0))))))
+ (if (uniform_vector_p (@0))))
(match vec_same_elem_p
@0