@@ -3226,10 +3226,8 @@ gimple_call_alloca_for_var_p (gimple_call s)
/* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
static inline void
-gimple_call_copy_flags (gimple dest_call, gimple orig_call)
+gimple_call_copy_flags (gimple_call dest_call, gimple_call orig_call)
{
- GIMPLE_CHECK (dest_call, GIMPLE_CALL);
- GIMPLE_CHECK (orig_call, GIMPLE_CALL);
dest_call->subcode = orig_call->subcode;
}
@@ -3664,7 +3664,7 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments)
contain the corresponding call graph edge. */
void
-ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
+ipa_modify_call_arguments (struct cgraph_edge *cs, gimple_call stmt,
ipa_parm_adjustment_vec adjustments)
{
struct cgraph_node *current_node = cgraph_get_node (current_function_decl);
@@ -687,7 +687,7 @@ typedef vec<ipa_parm_adjustment> ipa_parm_adjustment_vec;
vec<tree> ipa_get_vector_of_formal_parms (tree fndecl);
vec<tree> ipa_get_vector_of_formal_parm_types (tree fntype);
void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec);
-void ipa_modify_call_arguments (struct cgraph_edge *, gimple,
+void ipa_modify_call_arguments (struct cgraph_edge *, gimple_call,
ipa_parm_adjustment_vec);
ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
ipa_parm_adjustment_vec);
@@ -1678,10 +1678,12 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
do
{
tree fn;
+ gimple_call call_stmt;
stmt = gsi_stmt (copy_gsi);
- if (is_gimple_call (stmt)
- && gimple_call_va_arg_pack_p (stmt->as_a_gimple_call ())
+ call_stmt = stmt->dyn_cast_gimple_call ();
+ if (call_stmt
+ && gimple_call_va_arg_pack_p (call_stmt)
&& id->gimple_call)
{
/* __builtin_va_arg_pack () should be replaced by
@@ -1696,33 +1698,33 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
nargs--;
/* Create the new array of arguments. */
- n = nargs + gimple_call_num_args (stmt);
+ n = nargs + gimple_call_num_args (call_stmt);
argarray.create (n);
argarray.safe_grow_cleared (n);
/* Copy all the arguments before '...' */
memcpy (argarray.address (),
- gimple_call_arg_ptr (stmt, 0),
- gimple_call_num_args (stmt) * sizeof (tree));
+ gimple_call_arg_ptr (call_stmt, 0),
+ gimple_call_num_args (call_stmt) * sizeof (tree));
/* Append the arguments passed in '...' */
- memcpy (argarray.address () + gimple_call_num_args (stmt),
+ memcpy (argarray.address () + gimple_call_num_args (call_stmt),
gimple_call_arg_ptr (id->gimple_call, 0)
+ (gimple_call_num_args (id->gimple_call) - nargs),
nargs * sizeof (tree));
- new_call = gimple_build_call_vec (gimple_call_fn (stmt),
+ new_call = gimple_build_call_vec (gimple_call_fn (call_stmt),
argarray);
argarray.release ();
/* Copy all GIMPLE_CALL flags, location and block, except
GF_CALL_VA_ARG_PACK. */
- gimple_call_copy_flags (new_call, stmt);
+ gimple_call_copy_flags (new_call, call_stmt);
gimple_call_set_va_arg_pack (new_call, false);
gimple_set_location (new_call, gimple_location (stmt));
gimple_set_block (new_call, gimple_block (stmt));
- gimple_call_set_lhs (new_call, gimple_call_lhs (stmt));
+ gimple_call_set_lhs (new_call, gimple_call_lhs (call_stmt));
gsi_replace (©_gsi, new_call, false);
stmt = new_call;
@@ -4847,9 +4847,10 @@ convert_callers (struct cgraph_node *node, tree old_decl,
for (gsi = gsi_start_bb (this_block); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_call stmt;
tree call_fndecl;
- if (gimple_code (stmt) != GIMPLE_CALL)
+ stmt = gsi_stmt (gsi)->dyn_cast_gimple_call ();
+ if (!stmt)
continue;
call_fndecl = gimple_call_fndecl (stmt);
if (call_fndecl == old_decl)