* gimple.h (gimple_call_set_chain): Accept SSA variables.
* tree-ssa-pre.c (create_component_ref_by_pieces_1) <CALL_EXPR>:
Rematerialize the static chain, if any.
* tree-ssa-sccvn.c (copy_reference_ops_from_call): Also copy the
static chain.
From-SVN: r139072
+2008-08-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimple.h (gimple_call_set_chain): Accept SSA variables.
+ * tree-ssa-pre.c (create_component_ref_by_pieces_1) <CALL_EXPR>:
+ Rematerialize the static chain, if any.
+ * tree-ssa-sccvn.c (copy_reference_ops_from_call): Also copy the
+ static chain.
+
2008-08-13 H.J. Lu <hongjiu.lu@intel.com>
* dwarf2out.c (dwarf_stack_op_name): Remove prototype.
GIMPLE_CHECK (gs, GIMPLE_CALL);
gcc_assert (chain == NULL
|| TREE_CODE (chain) == ADDR_EXPR
- || DECL_P (chain));
+ || SSA_VAR_P (chain));
gimple_set_op (gs, 2, chain);
}
{
case CALL_EXPR:
{
- tree folded;
+ tree folded, sc = currop->op1;
unsigned int nargs = 0;
tree *args = XNEWVEC (tree, VEC_length (vn_reference_op_s,
ref->operands) - 1);
: currop->op0,
nargs, args);
free (args);
+ if (sc)
+ {
+ pre_expr scexpr = get_or_alloc_expr_for (sc);
+ sc = find_or_generate_expression (block, scexpr, stmts, domstmt);
+ if (!sc)
+ return NULL_TREE;
+ CALL_EXPR_STATIC_CHAIN (folded) = sc;
+ }
return folded;
}
break;
vn_reference_op_s temp;
unsigned i;
- /* Copy the call_expr opcode, type, function being called, and
- arguments. */
+ /* Copy the type, opcode, function being called and static chain. */
memset (&temp, 0, sizeof (temp));
temp.type = gimple_call_return_type (call);
temp.opcode = CALL_EXPR;
temp.op0 = gimple_call_fn (call);
+ temp.op1 = gimple_call_chain (call);
VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
/* Copy the call arguments. As they can be references as well,
tree callarg = gimple_call_arg (call, i);
copy_reference_ops_from_ref (callarg, result);
}
- return;
}
/* Create a vector of vn_reference_op_s structures from REF, a