summaryrefslogtreecommitdiff
path: root/gcc/ipa-split.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-20 12:02:33 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-20 12:02:33 +0000
commit9aa9c1e6c45a20ee240c49f5c752864138b6cf5d (patch)
tree9d88e1e3f15ab9bfda1ee6aa938b99bb599b7bb2 /gcc/ipa-split.c
parent34d5f36dee8fbac95a28fb1587c87c6669406343 (diff)
downloadgcc-9aa9c1e6c45a20ee240c49f5c752864138b6cf5d.tar.gz
PR tree-optimization/46130
* ipa-split.c (consider_split): If return_bb contains non-virtual PHIs other than for retval or if split_function would not adjust it, refuse to split. * gcc.dg/pr46130-1.c: New test. * gcc.dg/pr46130-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169052 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-split.c')
-rw-r--r--gcc/ipa-split.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index c72a36d67ee..30060440fe2 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -411,9 +411,6 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
" Refused: split part has non-ssa uses\n");
return;
}
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, " Accepted!\n");
-
/* See if retval used by return bb is computed by header or split part.
When it is computed by split part, we need to produce return statement
in the split part and add code to header to pass it around.
@@ -451,6 +448,30 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
else
current->split_part_set_retval = true;
+ /* split_function fixes up at most one PHI non-virtual PHI node in return_bb,
+ for the return value. If there are other PHIs, give up. */
+ if (return_bb != EXIT_BLOCK_PTR)
+ {
+ gimple_stmt_iterator psi;
+
+ for (psi = gsi_start_phis (return_bb); !gsi_end_p (psi); gsi_next (&psi))
+ if (is_gimple_reg (gimple_phi_result (gsi_stmt (psi)))
+ && !(retval
+ && current->split_part_set_retval
+ && TREE_CODE (retval) == SSA_NAME
+ && !DECL_BY_REFERENCE (DECL_RESULT (current_function_decl))
+ && SSA_NAME_DEF_STMT (retval) == gsi_stmt (psi)))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: return bb has extra PHIs\n");
+ return;
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " Accepted!\n");
+
/* At the moment chose split point with lowest frequency and that leaves
out smallest size of header.
In future we might re-consider this heuristics. */