diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-10 16:48:42 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-10 16:48:42 +0000 |
commit | c13d6d8f5f6dc7c57ada800e75f36080efeda6a4 (patch) | |
tree | 3414c4dc8a1eecc61ab246c7126be1ca6fb775d8 /gcc/ipa-split.c | |
parent | a15d5ede1b745b109884a8f94950aefc66836037 (diff) | |
download | gcc-c13d6d8f5f6dc7c57ada800e75f36080efeda6a4.tar.gz |
* PR tree-optimization/47141
* ipa-split.c (split_function): Handle case where we are returning a
value and the return block has a virtual operand phi.
* gcc.c-torture/compile/pr47141.c: New test.
Approved by richie in IRC
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168634 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-split.c')
-rw-r--r-- | gcc/ipa-split.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 4fcbfe940ba..ef6467b4e01 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -1016,20 +1016,31 @@ split_function (struct split_point *split_point) e->probability = REG_BR_PROB_BASE; e->count = new_return_bb->count; bitmap_set_bit (split_point->split_bbs, new_return_bb->index); - /* We change CFG in a way tree-inline is not able to compensate on while - updating PHIs. There are only virtuals in return_bb, so recompute - them. */ + } + /* When we pass around the value, use existing return block. */ + else + bitmap_set_bit (split_point->split_bbs, return_bb->index); + + /* If RETURN_BB has virtual operand PHIs, they must be removed and the + virtual operand marked for renaming as we change the CFG in a way that + tree-inline is not able to compensate for. + + Note this can happen whether or not we have a return value. If we have + a return value, then RETURN_BB may have PHIs for real operands too. */ + if (return_bb != EXIT_BLOCK_PTR) + { for (gsi = gsi_start_phis (return_bb); !gsi_end_p (gsi);) { gimple stmt = gsi_stmt (gsi); - gcc_assert (!is_gimple_reg (gimple_phi_result (stmt))); + if (is_gimple_reg (gimple_phi_result (stmt))) + { + gsi_next (&gsi); + continue; + } mark_virtual_phi_result_for_renaming (stmt); remove_phi_node (&gsi, true); } } - /* When we pass aorund the value, use existing return block. */ - else - bitmap_set_bit (split_point->split_bbs, return_bb->index); /* Now create the actual clone. */ rebuild_cgraph_edges (); |