gcc/ChangeLog.gimple-classes:
        * ipa-split.c (find_return_bb): Eliminate check for GIMPLE_ASSIGN
        since this is covered by gimple_assign_single_p, using the latter
        to introduce local gassign * "assign_stmt", using it in place
        of "stmt" for typesafety.
        (find_retval): Add a checked cast.
        (split_function): Replace check for GIMPLE_ASSIGN with a dyn_cast,
        introducing local "assign_stmt" and using it in place of
        gsi_stmt (bsi) for typesafety.
---
 gcc/ChangeLog.gimple-classes | 11 +++++++++++
 gcc/ipa-split.c              | 28 +++++++++++++++-------------
 2 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e4d85b2..08f045d 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,3 +1,14 @@
+2014-11-05  David Malcolm  <dmalc...@redhat.com>
+
+       * ipa-split.c (find_return_bb): Eliminate check for GIMPLE_ASSIGN
+       since this is covered by gimple_assign_single_p, using the latter
+       to introduce local gassign * "assign_stmt", using it in place
+       of "stmt" for typesafety.
+       (find_retval): Add a checked cast.
+       (split_function): Replace check for GIMPLE_ASSIGN with a dyn_cast,
+       introducing local "assign_stmt" and using it in place of
+       gsi_stmt (bsi) for typesafety.
+
 2014-11-04  David Malcolm  <dmalc...@redhat.com>
 
        * cfgexpand.c (add_scope_conflicts_1): Add checked cast.
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index ed5c1a7..4801d7f 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -704,6 +704,7 @@ find_return_bb (void)
   gimple_stmt_iterator bsi;
   bool found_return = false;
   tree retval = NULL_TREE;
+  gassign *assign_stmt;
 
   if (!single_pred_p (EXIT_BLOCK_PTR_FOR_FN (cfun)))
     return return_bb;
@@ -716,13 +717,13 @@ find_return_bb (void)
          || is_gimple_debug (stmt)
          || gimple_clobber_p (stmt))
        ;
-      else if (gimple_code (stmt) == GIMPLE_ASSIGN
-              && found_return
-              && gimple_assign_single_p (stmt)
-              && (auto_var_in_fn_p (gimple_assign_rhs1 (stmt),
+      else if (found_return
+              && (assign_stmt = gimple_assign_single_p (stmt))
+              && (auto_var_in_fn_p (gimple_assign_rhs1 (assign_stmt),
                                     current_function_decl)
-                  || is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
-              && retval == gimple_assign_lhs (stmt))
+                  || is_gimple_min_invariant (
+                       gimple_assign_rhs1 (assign_stmt)))
+              && retval == gimple_assign_lhs (assign_stmt))
        ;
       else if (greturn *return_stmt = dyn_cast <greturn *> (stmt))
        {
@@ -749,7 +750,7 @@ find_retval (basic_block return_bb)
       return gimple_return_retval (return_stmt);
     else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
             && !gimple_clobber_p (gsi_stmt (bsi)))
-      return gimple_assign_rhs1 (gsi_stmt (bsi));
+      return gimple_assign_rhs1 (as_a <gassign *> (gsi_stmt (bsi)));
   return NULL;
 }
 
@@ -1471,12 +1472,13 @@ split_function (struct split_point *split_point)
                            gimple_return_set_retval (return_stmt, retval);
                            break;
                          }
-                       else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
-                                && !gimple_clobber_p (gsi_stmt (bsi)))
-                         {
-                           gimple_assign_set_rhs1 (gsi_stmt (bsi), retval);
-                           break;
-                         }
+                       else if (gassign *assign_stmt =
+                                  dyn_cast <gassign *> (gsi_stmt (bsi)))
+                         if (!gimple_clobber_p (assign_stmt))
+                           {
+                             gimple_assign_set_rhs1 (assign_stmt, retval);
+                             break;
+                           }
                      update_stmt (gsi_stmt (bsi));
                    }
                }
-- 
1.7.11.7

Reply via email to