diff options
author | David Malcolm <dmalcolm@redhat.com> | 2014-11-05 16:26:49 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2014-11-05 16:26:49 -0500 |
commit | 142ae546021ef4397b636c60ef6f91259dcf8660 (patch) | |
tree | 6d339d0d7c2032c3ede7d456a6fbe9eded2b2e99 | |
parent | ac32e40a4621e69dac36b7c3982b035b36ba034e (diff) | |
download | gcc-142ae546021ef4397b636c60ef6f91259dcf8660.tar.gz |
ipa-split.c: Use gassign
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.
-rw-r--r-- | gcc/ChangeLog.gimple-classes | 11 | ||||
-rw-r--r-- | 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 e4d85b256c8..08f045d41e9 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,3 +1,14 @@ +2014-11-05 David Malcolm <dmalcolm@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 <dmalcolm@redhat.com> * cfgexpand.c (add_scope_conflicts_1): Add checked cast. diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index ed5c1a74168..4801d7f4335 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)); } } |