From c13d6d8f5f6dc7c57ada800e75f36080efeda6a4 Mon Sep 17 00:00:00 2001 From: law Date: Mon, 10 Jan 2011 16:48:42 +0000 Subject: * 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 --- gcc/ipa-split.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'gcc/ipa-split.c') 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 (); -- cgit v1.2.1