summaryrefslogtreecommitdiffstats
path: root/gcc/tree-tailcall.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-11 19:57:47 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-11 19:57:47 +0000
commit18a87dc56669e22791f05617497e902002eba4fd (patch)
tree3053fd7033c9fa15e5dc48ee261f16909ec7260e /gcc/tree-tailcall.c
parentbd0b04411fc5b484dd3f33cda5f2480326459252 (diff)
downloadppe42-gcc-18a87dc56669e22791f05617497e902002eba4fd.tar.gz
ppe42-gcc-18a87dc56669e22791f05617497e902002eba4fd.zip
PR tree-optimization/15654
* tree-tailcall.c (eliminate_tail_call): Remove unreachable code. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84527 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-tailcall.c')
-rw-r--r--gcc/tree-tailcall.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 323c239cece..fdd010f160c 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -647,6 +647,7 @@ eliminate_tail_call (struct tailcall *t)
stmt_ann_t ann;
v_may_def_optype v_may_defs;
unsigned i;
+ block_stmt_iterator bsi;
stmt = bsi_stmt (t->call_bsi);
get_stmt_operands (stmt);
@@ -666,6 +667,21 @@ eliminate_tail_call (struct tailcall *t)
first = ENTRY_BLOCK_PTR->succ->dest;
+ /* Remove the code after call_bsi that will become unreachable. The
+ possibly unreachable code in other blocks is removed later in
+ cfg cleanup. */
+ bsi = t->call_bsi;
+ bsi_next (&bsi);
+ while (!bsi_end_p (bsi))
+ {
+ /* Do not remove the return statement, so that redirect_edge_and_branch
+ sees how the block ends. */
+ if (TREE_CODE (bsi_stmt (bsi)) == RETURN_EXPR)
+ break;
+
+ bsi_remove (&bsi);
+ }
+
/* Replace the call by a jump to the start of function. */
e = redirect_edge_and_branch (t->call_block->succ, first);
if (!e)
OpenPOWER on IntegriCloud