aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-06-26 16:45:40 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-06-26 14:45:40 +0000
commit8b3057b30d78d0e30ec9f0db8806229bd8f28dfc (patch)
tree48fb4136d3d63a84f88676d81afbfd202920e87e /gcc/tree-inline.c
parent6bfd4302547d10962648eb1dddd4020cf8017ada (diff)
downloadgcc-8b3057b30d78d0e30ec9f0db8806229bd8f28dfc.zip
gcc-8b3057b30d78d0e30ec9f0db8806229bd8f28dfc.tar.gz
gcc-8b3057b30d78d0e30ec9f0db8806229bd8f28dfc.tar.bz2
ipa-split-2.c: New testcase.
* gcc.dg/tree-ssa/ipa-split-2.c: New testcase. * ipa-split.c (consider_split): PHI in entry block is OK as long as all edges comming from header are equivalent. (visit_bb): Handle PHIs correctly. * tree-inline.c (copy_phis_for_bb): Be able to copy PHI from entry edge. (copy_cfg_body): Produce edge from entry BB before copying PHIs. From-SVN: r161433
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index f446fa7..a419c26 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1969,11 +1969,22 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
= new_phi = create_phi_node (new_res, new_bb);
FOR_EACH_EDGE (new_edge, ei, new_bb->preds)
{
- edge const old_edge
- = find_edge ((basic_block) new_edge->src->aux, bb);
- tree arg = PHI_ARG_DEF_FROM_EDGE (phi, old_edge);
- tree new_arg = arg;
+ edge old_edge = find_edge ((basic_block) new_edge->src->aux, bb);
+ tree arg;
+ tree new_arg;
tree block = id->block;
+ edge_iterator ei2;
+
+ /* When doing partial clonning, we allow PHIs on the entry block
+ as long as all the arguments are the same. Find any input
+ edge to see argument to copy. */
+ if (!old_edge)
+ FOR_EACH_EDGE (old_edge, ei2, bb->preds)
+ if (!old_edge->src->aux)
+ break;
+
+ arg = PHI_ARG_DEF_FROM_EDGE (phi, old_edge);
+ new_arg = arg;
id->block = NULL_TREE;
walk_tree (&new_arg, copy_tree_body_r, id, NULL);
id->block = block;
@@ -2191,12 +2202,6 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
|| (bb->index > 0 && bitmap_bit_p (blocks_to_copy, bb->index)))
need_debug_cleanup |= copy_edges_for_bb (bb, count_scale, exit_block_map);
- if (gimple_in_ssa_p (cfun))
- FOR_ALL_BB_FN (bb, cfun_to_copy)
- if (!blocks_to_copy
- || (bb->index > 0 && bitmap_bit_p (blocks_to_copy, bb->index)))
- copy_phis_for_bb (bb, id);
-
if (new_entry)
{
edge e;
@@ -2205,6 +2210,12 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
e->count = entry_block_map->count;
}
+ if (gimple_in_ssa_p (cfun))
+ FOR_ALL_BB_FN (bb, cfun_to_copy)
+ if (!blocks_to_copy
+ || (bb->index > 0 && bitmap_bit_p (blocks_to_copy, bb->index)))
+ copy_phis_for_bb (bb, id);
+
FOR_ALL_BB_FN (bb, cfun_to_copy)
if (bb->aux)
{