summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dce.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-19 10:27:07 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-19 10:27:07 +0000
commita5d536df523c382cc266ab846912060a2a888eca (patch)
tree18a19d1d0d3ba0f9e6bb73f587b8903c2c74a669 /gcc/tree-ssa-dce.c
parent02c01bafd50499be42e2bd94f35531c134d7c7e3 (diff)
downloadgcc-a5d536df523c382cc266ab846912060a2a888eca.tar.gz
PR tree-optimization/40676
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Do renaming on all virtual PHIs in empty BBs. * gcc.c-torture/compile/pr40676.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149789 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r--gcc/tree-ssa-dce.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index fdfdda5e95f..86134ad0970 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1137,7 +1137,8 @@ eliminate_unnecessary_stmts (void)
for (bb = ENTRY_BLOCK_PTR->next_bb; bb != EXIT_BLOCK_PTR; bb = next_bb)
{
next_bb = bb->next_bb;
- if (!(bb->flags & BB_REACHABLE))
+ if (!TEST_BIT (bb_contains_live_stmts, bb->index)
+ || !(bb->flags & BB_REACHABLE))
{
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
if (!is_gimple_reg (gimple_phi_result (gsi_stmt (gsi))))
@@ -1159,7 +1160,8 @@ eliminate_unnecessary_stmts (void)
if (found)
mark_virtual_phi_result_for_renaming (gsi_stmt (gsi));
}
- delete_basic_block (bb);
+ if (!(bb->flags & BB_REACHABLE))
+ delete_basic_block (bb);
}
}
}