summaryrefslogtreecommitdiff
path: root/gcc/ipa-split.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-19 19:58:37 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-19 19:58:37 +0000
commitb234c94d03a83c5ae4f7741e04662adfe398a74f (patch)
treea6b7079dc0c7cf2bfa1ad869ea121d438e54d9eb /gcc/ipa-split.c
parent574c4ab554ca8a03733b25f1b2692eb148a45818 (diff)
downloadgcc-b234c94d03a83c5ae4f7741e04662adfe398a74f.tar.gz
* ipa-split.c (find_return_bb): Use single_pred_p/single_pred_edge,
simplify. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169020 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-split.c')
-rw-r--r--gcc/ipa-split.c68
1 files changed, 30 insertions, 38 deletions
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index d5bf35fcc27..c72a36d67ee 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -496,47 +496,39 @@ static basic_block
find_return_bb (void)
{
edge e;
- edge_iterator ei;
basic_block return_bb = EXIT_BLOCK_PTR;
+ gimple_stmt_iterator bsi;
+ bool found_return = false;
+ tree retval = NULL_TREE;
- if (EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 1)
- FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds)
- {
- gimple_stmt_iterator bsi;
- bool found_return = false;
- tree retval = NULL_TREE;
+ if (!single_pred_p (EXIT_BLOCK_PTR))
+ return return_bb;
+
+ e = single_pred_edge (EXIT_BLOCK_PTR);
+ for (bsi = gsi_last_bb (e->src); !gsi_end_p (bsi); gsi_prev (&bsi))
+ {
+ gimple stmt = gsi_stmt (bsi);
+ if (gimple_code (stmt) == GIMPLE_LABEL || is_gimple_debug (stmt))
+ ;
+ else if (gimple_code (stmt) == GIMPLE_ASSIGN
+ && found_return
+ && gimple_assign_single_p (stmt)
+ && (auto_var_in_fn_p (gimple_assign_rhs1 (stmt),
+ current_function_decl)
+ || is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
+ && retval == gimple_assign_lhs (stmt))
+ ;
+ else if (gimple_code (stmt) == GIMPLE_RETURN)
+ {
+ found_return = true;
+ retval = gimple_return_retval (stmt);
+ }
+ else
+ break;
+ }
+ if (gsi_end_p (bsi) && found_return)
+ return_bb = e->src;
- for (bsi = gsi_last_bb (e->src); !gsi_end_p (bsi); gsi_prev (&bsi))
- {
- gimple stmt = gsi_stmt (bsi);
- if (gimple_code (stmt) == GIMPLE_LABEL
- || is_gimple_debug (stmt))
- ;
- else if (gimple_code (stmt) == GIMPLE_ASSIGN
- && found_return
- && gimple_assign_single_p (stmt)
- && (auto_var_in_fn_p (gimple_assign_rhs1 (stmt),
- current_function_decl)
- || is_gimple_min_invariant
- (gimple_assign_rhs1 (stmt)))
- && retval == gimple_assign_lhs (stmt))
- ;
- else if (gimple_code (stmt) == GIMPLE_RETURN)
- {
- found_return = true;
- retval = gimple_return_retval (stmt);
- }
- else
- break;
- }
- if (gsi_end_p (bsi) && found_return)
- {
- if (retval)
- return e->src;
- else
- return_bb = e->src;
- }
- }
return return_bb;
}