SSA form is kept up to date except for VOPs when CFG was removed
so only set update ssa TODO if the CFG has changed. This is still
sets the TODO in more cases than it is needed but it reduces enough
to make difference.

Bootstrappd and tested on x86_64-linux-gnu.

gcc/ChangeLog:

        * tree-ssa-dce.cc (perform_tree_ssa_dce): Set TODO_update_ssa
        only when cfg has changed

Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
---
 gcc/tree-ssa-dce.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc
index ba9cd6536ae..f5e67c4409a 100644
--- a/gcc/tree-ssa-dce.cc
+++ b/gcc/tree-ssa-dce.cc
@@ -2167,7 +2167,11 @@ perform_tree_ssa_dce (bool aggressive)
       free_numbers_of_iterations_estimates (cfun);
       if (in_loop_pipeline)
        scev_reset ();
-      todo |= TODO_update_ssa | TODO_cleanup_cfg;
+      todo |= TODO_cleanup_cfg;
+      /* If the cfg has been modified, then there might
+        have been virtual op that needs to be updated.  */
+      if (cfg_altered)
+       todo |= TODO_update_ssa;
     }
   return todo;
 }
-- 
2.43.0

Reply via email to