From c27998546ac2291ceffbf1f998f6e46e6b8ad6eb Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 2 May 2019 11:17:00 +0000 Subject: [PATCH] re PR tree-optimization/90273 (GCC runs out of memory building Firefox) 2019-05-02 Richard Biener PR tree-optimization/90273 * tree-ssa-dce.c (eliminate_unnecessary_stmts): Eliminate useless debug stmts. From-SVN: r270791 --- gcc/ChangeLog | 6 ++++++ gcc/tree-ssa-dce.c | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 720627bc702..1f55cd18210 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-05-02 Richard Biener + + PR tree-optimization/90273 + * tree-ssa-dce.c (eliminate_unnecessary_stmts): Eliminate + useless debug stmts. + 2019-05-02 Alejandro Martinez * config/aarch64/aarch64-sve.md (dot_prod): Taken from SVE diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index c0e122722c0..4853f0bd73e 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -1237,6 +1237,7 @@ eliminate_unnecessary_stmts (void) bb = h.pop (); /* Remove dead statements. */ + auto_bitmap debug_seen; for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi = psi) { stmt = gsi_stmt (gsi); @@ -1282,11 +1283,15 @@ eliminate_unnecessary_stmts (void) } } if (!dead) - continue; + { + bitmap_clear (debug_seen); + continue; + } } if (!is_gimple_debug (stmt)) something_changed = true; remove_dead_stmt (&gsi, bb, to_remove_edges); + continue; } else if (is_gimple_call (stmt)) { @@ -1352,6 +1357,18 @@ eliminate_unnecessary_stmts (void) break; } } + else if (gimple_debug_bind_p (stmt)) + { + /* We are only keeping the last debug-bind of a + non-DEBUG_EXPR_DECL variable in a series of + debug-bind stmts. */ + tree var = gimple_debug_bind_get_var (stmt); + if (TREE_CODE (var) != DEBUG_EXPR_DECL + && !bitmap_set_bit (debug_seen, DECL_UID (var))) + remove_dead_stmt (&gsi, bb, to_remove_edges); + continue; + } + bitmap_clear (debug_seen); } /* Remove dead PHI nodes. */ -- 2.30.2