tree-pass.h (make_pass_dce_loop): Remove.
authorRichard Biener <rguenther@suse.de>
Wed, 18 Jun 2014 11:45:17 +0000 (11:45 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 18 Jun 2014 11:45:17 +0000 (11:45 +0000)
2014-06-18  Richard Biener  <rguenther@suse.de>

* tree-pass.h (make_pass_dce_loop): Remove.
* passes.def: Replace pass_dce_loop with pass_dce.
* tree-ssa-dce.c (perform_tree_ssa_dce): If something
changed free niter estimates and reset the scev cache.
(tree_ssa_dce_loop, pass_data_dce_loop, pass_dce_loop,
make_pass_dce_loop): Remove.
* tree-ssa-copy.c: Include tree-ssa-loop-niter.h.
(fini_copy_prop): Return whether something changed.  Always
let substitute_and_fold perform DCE and free niter estimates
and reset the scev cache if so.
(execute_copy_prop): If sth changed schedule cleanup-cfg.
(pass_data_copy_prop): Do not unconditionally schedule
cleanup-cfg or update-ssa.

* gcc.dg/vect/vect.exp: Remove dump-tree-dceloop-* processing.
* gcc.dg/vect/dump-tree-dceloop-pr26359.c: Rename to ...
* gcc.dg/vect/pr26359.c: ... this and adjust appropriately.

From-SVN: r211781

gcc/ChangeLog
gcc/passes.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/dump-tree-dceloop-pr26359.c [deleted file]
gcc/testsuite/gcc.dg/vect/pr26359.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/vect.exp
gcc/tree-pass.h
gcc/tree-ssa-copy.c
gcc/tree-ssa-dce.c

index 19f33b2041c67dc1911331113c11efdf8d2c757c..b7acf344edb1c2a8b2a5b30b4afdb41f8a32c8a7 100644 (file)
@@ -1,3 +1,19 @@
+2014-06-18  Richard Biener  <rguenther@suse.de>
+
+       * tree-pass.h (make_pass_dce_loop): Remove.
+       * passes.def: Replace pass_dce_loop with pass_dce.
+       * tree-ssa-dce.c (perform_tree_ssa_dce): If something
+       changed free niter estimates and reset the scev cache.
+       (tree_ssa_dce_loop, pass_data_dce_loop, pass_dce_loop,
+       make_pass_dce_loop): Remove.
+       * tree-ssa-copy.c: Include tree-ssa-loop-niter.h.
+       (fini_copy_prop): Return whether something changed.  Always
+       let substitute_and_fold perform DCE and free niter estimates
+       and reset the scev cache if so.
+       (execute_copy_prop): If sth changed schedule cleanup-cfg.
+       (pass_data_copy_prop): Do not unconditionally schedule
+       cleanup-cfg or update-ssa.
+
 2014-06-18  Yuri Rumyantsev  <ysrumyan@gmail.com>
 
        PR tree-optimization/61518
index f305c608c1d67f46c9009cfb23014bedde75efd6..26b30c938f1b8a2c723977e776f064a1e16dfbed 100644 (file)
@@ -203,7 +203,7 @@ along with GCC; see the file COPYING3.  If not see
          NEXT_PASS (pass_tree_loop_init);
          NEXT_PASS (pass_lim);
          NEXT_PASS (pass_copy_prop);
-         NEXT_PASS (pass_dce_loop);
+         NEXT_PASS (pass_dce);
          NEXT_PASS (pass_tree_unswitch);
          NEXT_PASS (pass_scev_cprop);
          NEXT_PASS (pass_record_bounds);
@@ -215,7 +215,7 @@ along with GCC; see the file COPYING3.  If not see
              NEXT_PASS (pass_graphite_transforms);
              NEXT_PASS (pass_lim);
              NEXT_PASS (pass_copy_prop);
-             NEXT_PASS (pass_dce_loop);
+             NEXT_PASS (pass_dce);
          POP_INSERT_PASSES ()
          NEXT_PASS (pass_iv_canon);
          NEXT_PASS (pass_parallelize_loops);
@@ -224,7 +224,7 @@ along with GCC; see the file COPYING3.  If not see
             Please do not add any other passes in between.  */
          NEXT_PASS (pass_vectorize);
           PUSH_INSERT_PASSES_WITHIN (pass_vectorize)
-             NEXT_PASS (pass_dce_loop);
+             NEXT_PASS (pass_dce);
           POP_INSERT_PASSES ()
           NEXT_PASS (pass_predcom);
          NEXT_PASS (pass_complete_unroll);
index 702fc36af5cf592bab98e637db7608f8b46d3ad4..52c4bef538fc7a563418fc73264b429404a936bb 100644 (file)
@@ -1,3 +1,23 @@
+2014-06-18  Richard Biener  <rguenther@suse.de>
+
+       * tree-pass.h (make_pass_dce_loop): Remove.
+       * passes.def: Replace pass_dce_loop with pass_dce.
+       * tree-ssa-dce.c (perform_tree_ssa_dce): If something
+       changed free niter estimates and reset the scev cache.
+       (tree_ssa_dce_loop, pass_data_dce_loop, pass_dce_loop,
+       make_pass_dce_loop): Remove.
+       * tree-ssa-copy.c: Include tree-ssa-loop-niter.h.
+       (fini_copy_prop): Return whether something changed.  Always
+       let substitute_and_fold perform DCE and free niter estimates
+       and reset the scev cache if so.
+       (execute_copy_prop): If sth changed schedule cleanup-cfg.
+       (pass_data_copy_prop): Do not unconditionally schedule
+       cleanup-cfg or update-ssa.
+
+       * gcc.dg/vect/vect.exp: Remove dump-tree-dceloop-* processing.
+       * gcc.dg/vect/dump-tree-dceloop-pr26359.c: Rename to ...
+       * gcc.dg/vect/pr26359.c: ... this and adjust appropriately.
+
 2014-06-18  Yuri Rumyantsev  <ysrumyan@gmail.com>
 
        PR tree-optimization/61518
diff --git a/gcc/testsuite/gcc.dg/vect/dump-tree-dceloop-pr26359.c b/gcc/testsuite/gcc.dg/vect/dump-tree-dceloop-pr26359.c
deleted file mode 100644 (file)
index ae7aea2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* { dg-require-effective-target vect_int } */
-
-int a[256], b[256], c[256];
-
-foo () {
-  int i;
-
-  for (i=0; i<256; i++){
-    a[i] = b[i] + c[i];
-  }
-}
-
-/* { dg-final { scan-tree-dump-times "Deleting : vect_" 0 "dceloop3" } } */
-/* { dg-final { cleanup-tree-dump "dceloop\[1-3\]" } } */
-/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr26359.c b/gcc/testsuite/gcc.dg/vect/pr26359.c
new file mode 100644 (file)
index 0000000..f4e2a37
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-fdump-tree-dce5-details" } */
+
+int a[256], b[256], c[256];
+
+foo () {
+  int i;
+
+  for (i=0; i<256; i++){
+    a[i] = b[i] + c[i];
+  }
+}
+
+/* { dg-final { scan-tree-dump-times "Deleting : vect_" 0 "dce5" } } */
+/* { dg-final { cleanup-tree-dump "dce" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
index e8d866b991c93133c358b93e1b5443874e9c66e3..9fc8c18160e8d76a404ef5b5d43938183011014d 100644 (file)
@@ -138,12 +138,6 @@ lappend DEFAULT_VECTCFLAGS "-ftrapv"
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]]  \
        "" $DEFAULT_VECTCFLAGS
 
-# -fdump-tree-dceloop-details tests
-set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
-lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
-
 # -fno-tree-dce tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
index 3888bb66189736456ecd787b866293bee337eb27..bdaf673e3a42ad1ccdd205a2e800c5c3e332bd36 100644 (file)
@@ -382,7 +382,6 @@ extern gimple_opt_pass *make_pass_build_alias (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_build_ealias (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_dominator (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_dce (gcc::context *ctxt);
-extern gimple_opt_pass *make_pass_dce_loop (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_cd_dce (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_call_cdce (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_merge_phi (gcc::context *ctxt);
index e0ed63f0a44e922aa791e42c3fd0203f8ea2fb20..1d404d27b14488512deaae84d8a281b82b284e79 100644 (file)
@@ -45,6 +45,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "cfgloop.h"
 #include "tree-scalar-evolution.h"
 #include "tree-ssa-dom.h"
+#include "tree-ssa-loop-niter.h"
+
 
 /* This file implements the copy propagation pass and provides a
    handful of interfaces for performing const/copy propagation and
@@ -542,7 +544,7 @@ get_value (tree name)
 /* Deallocate memory used in copy propagation and do final
    substitution.  */
 
-static void
+static bool
 fini_copy_prop (void)
 {
   unsigned i;
@@ -594,10 +596,17 @@ fini_copy_prop (void)
        }
     }
 
-  /* Don't do DCE if SCEV is initialized.  It would destroy the scev cache.  */
-  substitute_and_fold (get_value, NULL, !scev_initialized_p ());
+  bool changed = substitute_and_fold (get_value, NULL, true);
+  if (changed)
+    {
+      free_numbers_of_iterations_estimates ();
+      if (scev_initialized_p ())
+       scev_reset ();
+    }
 
   free (copy_of);
+
+  return changed;
 }
 
 
@@ -639,7 +648,8 @@ execute_copy_prop (void)
 {
   init_copy_prop ();
   ssa_propagate (copy_prop_visit_stmt, copy_prop_visit_phi_node);
-  fini_copy_prop ();
+  if (fini_copy_prop ())
+    return TODO_cleanup_cfg;
   return 0;
 }
 
@@ -656,7 +666,7 @@ const pass_data pass_data_copy_prop =
   0, /* properties_provided */
   0, /* properties_destroyed */
   0, /* todo_flags_start */
-  ( TODO_cleanup_cfg | TODO_update_ssa ), /* todo_flags_finish */
+  0, /* todo_flags_finish */
 };
 
 class pass_copy_prop : public gimple_opt_pass
index 4969b11c1685a41c20f25d406abbb28bf63f660e..171d216135ee713eada93107d7c50e32b39c1094 100644 (file)
@@ -1479,7 +1479,12 @@ perform_tree_ssa_dce (bool aggressive)
   tree_dce_done (aggressive);
 
   if (something_changed)
-    return TODO_update_ssa | TODO_cleanup_cfg;
+    {
+      free_numbers_of_iterations_estimates ();
+      if (scev_initialized_p)
+       scev_reset ();
+      return TODO_update_ssa | TODO_cleanup_cfg;
+    }
   return 0;
 }
 
@@ -1490,19 +1495,6 @@ tree_ssa_dce (void)
   return perform_tree_ssa_dce (/*aggressive=*/false);
 }
 
-static unsigned int
-tree_ssa_dce_loop (void)
-{
-  unsigned int todo;
-  todo = perform_tree_ssa_dce (/*aggressive=*/false);
-  if (todo)
-    {
-      free_numbers_of_iterations_estimates ();
-      scev_reset ();
-    }
-  return todo;
-}
-
 static unsigned int
 tree_ssa_cd_dce (void)
 {
@@ -1549,44 +1541,6 @@ make_pass_dce (gcc::context *ctxt)
 
 namespace {
 
-const pass_data pass_data_dce_loop =
-{
-  GIMPLE_PASS, /* type */
-  "dceloop", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_DCE, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_dce_loop : public gimple_opt_pass
-{
-public:
-  pass_dce_loop (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_dce_loop, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_dce_loop (m_ctxt); }
-  virtual bool gate (function *) { return flag_tree_dce != 0; }
-  virtual unsigned int execute (function *) { return tree_ssa_dce_loop (); }
-
-}; // class pass_dce_loop
-
-} // anon namespace
-
-gimple_opt_pass *
-make_pass_dce_loop (gcc::context *ctxt)
-{
-  return new pass_dce_loop (ctxt);
-}
-
-namespace {
-
 const pass_data pass_data_cd_dce =
 {
   GIMPLE_PASS, /* type */