gcc/
        * gimple.h (gimple_call_copy_flags): Require gimple_calls.

        * ipa-prop.c (ipa_modify_call_arguments): Require a gimple_call.
        * ipa-prop.h (ipa_modify_call_arguments): Likewise.

        * tree-inline.c (copy_bb): Replace is_gimple_call with new local
        and call to dyn_cast_gimple_call, updating gimple_call_ uses to use
        the type-checked local.

        * tree-sra.c (convert_callers): Replace check for GIMPLE_CALL with
        a dyn_cast.
---
 gcc/gimple.h      |  4 +---
 gcc/ipa-prop.c    |  2 +-
 gcc/ipa-prop.h    |  2 +-
 gcc/tree-inline.c | 20 +++++++++++---------
 gcc/tree-sra.c    |  5 +++--
 5 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/gcc/gimple.h b/gcc/gimple.h
index d487629..feecc0d 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -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;
 }
 
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 5f2f02f..a521525 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -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);
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index bf3602c..676db02 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -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);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 274b073..dbc024d 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -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 (&copy_gsi, new_call, false);
              stmt = new_call;
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 223909e..b591b39 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -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)
-- 
1.8.5.3

Reply via email to