gcc/
        * gimple.h (gimple_call_return_slot_opt_p): Require a gimple_call
        rather than a plain gimple.

        * gimple-walk.c (walk_stmt_load_store_addr_ops): Convert usage of
        is_gimple_call to dyn_cast_gimple_call, introducing a new local
        "call_stmt".

        * trans-mem.c (expand_call_tm): Split local "stmt", strengthening
        from plain gimple to a gimple_call, and introducing new local
        gimple_assign "assign_stmt".

        * tree-inline.c (expand_call_inline):  Convert check of code against
        GIMPLE_CALL to dyn_cast_gimple_call, introducing a new local
        "call_stmt".
---
 gcc/gimple-walk.c | 26 +++++++++++++-------------
 gcc/gimple.h      |  3 +--
 gcc/trans-mem.c   | 11 ++++++-----
 gcc/tree-inline.c |  6 ++++--
 4 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 63200a2..cdb5516 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -758,11 +758,11 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
            }
        }
     }
-  else if (is_gimple_call (stmt))
+  else if (gimple_call call_stmt = stmt->dyn_cast_gimple_call ())
     {
       if (visit_store)
        {
-         tree arg = gimple_call_lhs (stmt);
+         tree arg = gimple_call_lhs (call_stmt);
          if (arg)
            {
              tree lhs = get_base_loadstore (arg);
@@ -771,9 +771,9 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
            }
        }
       if (visit_load || visit_addr)
-       for (i = 0; i < gimple_call_num_args (stmt); ++i)
+       for (i = 0; i < gimple_call_num_args (call_stmt); ++i)
          {
-           tree arg = gimple_call_arg (stmt, i);
+           tree arg = gimple_call_arg (call_stmt, i);
            if (visit_addr
                && TREE_CODE (arg) == ADDR_EXPR)
              ret |= visit_addr (stmt, TREE_OPERAND (arg, 0), arg, data);
@@ -785,16 +785,16 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
              }
          }
       if (visit_addr
-         && gimple_call_chain (stmt)
-         && TREE_CODE (gimple_call_chain (stmt)) == ADDR_EXPR)
-       ret |= visit_addr (stmt, TREE_OPERAND (gimple_call_chain (stmt), 0),
-                          gimple_call_chain (stmt), data);
+         && gimple_call_chain (call_stmt)
+         && TREE_CODE (gimple_call_chain (call_stmt)) == ADDR_EXPR)
+       ret |= visit_addr (stmt, TREE_OPERAND (gimple_call_chain (call_stmt), 
0),
+                          gimple_call_chain (call_stmt), data);
       if (visit_addr
-         && gimple_call_return_slot_opt_p (stmt)
-         && gimple_call_lhs (stmt) != NULL_TREE
-         && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt))))
-       ret |= visit_addr (stmt, gimple_call_lhs (stmt),
-                          gimple_call_lhs (stmt), data);
+         && gimple_call_return_slot_opt_p (call_stmt)
+         && gimple_call_lhs (call_stmt) != NULL_TREE
+         && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (call_stmt))))
+       ret |= visit_addr (stmt, gimple_call_lhs (call_stmt),
+                          gimple_call_lhs (call_stmt), data);
     }
   else if (gimple_asm asm_stmt = stmt->dyn_cast_gimple_asm ())
     {
diff --git a/gcc/gimple.h b/gcc/gimple.h
index c48b3d5..49385bd 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3119,9 +3119,8 @@ gimple_call_set_return_slot_opt (gimple_call s, bool 
return_slot_opt_p)
 /* Return true if S is marked for return slot optimization.  */
 
 static inline bool
-gimple_call_return_slot_opt_p (gimple s)
+gimple_call_return_slot_opt_p (gimple_call s)
 {
-  GIMPLE_CHECK (s, GIMPLE_CALL);
   return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
 }
 
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 7911ad6..62d9b78 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2362,7 +2362,7 @@ static bool
 expand_call_tm (struct tm_region *region,
                gimple_stmt_iterator *gsi)
 {
-  gimple stmt = gsi_stmt (*gsi);
+  gimple_call stmt = gsi_stmt (*gsi)->as_a_gimple_call ();
   tree lhs = gimple_call_lhs (stmt);
   tree fn_decl;
   struct cgraph_node *node;
@@ -2449,6 +2449,7 @@ expand_call_tm (struct tm_region *region,
       tree tmp = create_tmp_reg (TREE_TYPE (lhs), NULL);
       location_t loc = gimple_location (stmt);
       edge fallthru_edge = NULL;
+      gimple_assign assign_stmt;
 
       /* Remember if the call was going to throw.  */
       if (stmt_can_throw_internal (stmt))
@@ -2467,15 +2468,15 @@ expand_call_tm (struct tm_region *region,
 
       gimple_call_set_lhs (stmt, tmp);
       update_stmt (stmt);
-      stmt = gimple_build_assign (lhs, tmp);
-      gimple_set_location (stmt, loc);
+      assign_stmt = gimple_build_assign (lhs, tmp);
+      gimple_set_location (assign_stmt, loc);
 
       /* We cannot throw in the middle of a BB.  If the call was going
         to throw, place the instrumentation on the fallthru edge, so
         the call remains the last statement in the block.  */
       if (fallthru_edge)
        {
-         gimple_seq fallthru_seq = gimple_seq_alloc_with_stmt (stmt);
+         gimple_seq fallthru_seq = gimple_seq_alloc_with_stmt (assign_stmt);
          gimple_stmt_iterator fallthru_gsi = gsi_start (fallthru_seq);
          expand_assign_tm (region, &fallthru_gsi);
          gsi_insert_seq_on_edge (fallthru_edge, fallthru_seq);
@@ -2483,7 +2484,7 @@ expand_call_tm (struct tm_region *region,
        }
       else
        {
-         gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING);
+         gsi_insert_after (gsi, assign_stmt, GSI_CONTINUE_LINKING);
          expand_assign_tm (region, gsi);
        }
 
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 291dbf7..cdc2ff2 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4123,6 +4123,7 @@ expand_call_inline (basic_block bb, gimple stmt, 
copy_body_data *id)
   gimple_stmt_iterator gsi, stmt_gsi;
   bool successfully_inlined = FALSE;
   bool purge_dead_abnormal_edges;
+  gimple_call call_stmt;
 
   /* Set input_location here so we get the right instantiation context
      if we call instantiate_decl from inlinable_function_p.  */
@@ -4131,7 +4132,8 @@ expand_call_inline (basic_block bb, gimple stmt, 
copy_body_data *id)
   input_location = gimple_location (stmt);
 
   /* From here on, we're only interested in CALL_EXPRs.  */
-  if (gimple_code (stmt) != GIMPLE_CALL)
+  call_stmt = stmt->dyn_cast_gimple_call ();
+  if (!call_stmt)
     goto egress;
 
   cg_edge = cgraph_edge (id->dst_node, stmt);
@@ -4341,7 +4343,7 @@ expand_call_inline (basic_block bb, gimple stmt, 
copy_body_data *id)
       if (DECL_P (modify_dest))
        TREE_NO_WARNING (modify_dest) = 1;
 
-      if (gimple_call_return_slot_opt_p (stmt))
+      if (gimple_call_return_slot_opt_p (call_stmt))
        {
          return_slot = modify_dest;
          modify_dest = NULL;
-- 
1.8.5.3

Reply via email to