re PR tree-optimization/90273 (GCC runs out of memory building Firefox)
authorRichard Biener <rguenther@suse.de>
Thu, 2 May 2019 11:17:00 +0000 (11:17 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 2 May 2019 11:17:00 +0000 (11:17 +0000)
2019-05-02  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90273
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Eliminate
useless debug stmts.

From-SVN: r270791

gcc/ChangeLog
gcc/tree-ssa-dce.c

index 720627bc70293f56e99485623b8d8720cb2ff943..1f55cd18210ebebf630ad0f1934673e8aefb613d 100644 (file)
@@ -1,3 +1,9 @@
+2019-05-02  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90273
+       * tree-ssa-dce.c (eliminate_unnecessary_stmts): Eliminate
+       useless debug stmts.
+
 2019-05-02  Alejandro Martinez  <alejandro.martinezvicente@arm.com>
 
        * config/aarch64/aarch64-sve.md (<sur>dot_prod<vsi2qi>): Taken from SVE
index c0e122722c0dcfa70b455edaef97779f760c4494..4853f0bd73e1eba28a80b3a6166aef5be9a9b80d 100644 (file)
@@ -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.  */