]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2017-06-16 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Jun 2017 12:19:24 +0000 (12:19 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Jun 2017 12:19:24 +0000 (12:19 +0000)
PR tree-optimization/81090
* passes.def (pass_record_bounds): Remove.
* tree-pass.h (make_pass_record_bounds): Likewise.
* tree-ssa-loop.c (pass_data_record_bounds, pass_record_bounds,
make_pass_record_bounds): Likewise.
* tree-ssa-loop-ivcanon.c (canonicalize_induction_variables): Do
not free niter estimates at the beginning but at the end.
* tree-scalar-evolution.c (scev_finalize): Free niter estimates.

* gcc.dg/graphite/pr81090.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249249 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/passes.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr81090.c [new file with mode: 0644]
gcc/tree-pass.h
gcc/tree-scalar-evolution.c
gcc/tree-ssa-loop-ivcanon.c
gcc/tree-ssa-loop.c

index 258f6cb98692d025fe4fc434416aaaa58b2a8a0b..b55b0cecd7a81642bc87d270f314813116c14d7f 100644 (file)
@@ -1,3 +1,14 @@
+2017-06-16  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/81090
+       * passes.def (pass_record_bounds): Remove.
+       * tree-pass.h (make_pass_record_bounds): Likewise.
+       * tree-ssa-loop.c (pass_data_record_bounds, pass_record_bounds,
+       make_pass_record_bounds): Likewise.
+       * tree-ssa-loop-ivcanon.c (canonicalize_induction_variables): Do
+       not free niter estimates at the beginning but at the end.
+       * tree-scalar-evolution.c (scev_finalize): Free niter estimates.
+
 2017-06-16  Richard Biener  <rguenther@suse.de>
 
        * tree-switch-conversion.c (emit_case_bit_tests): Adjust
index 25e9d974bc8f44185063f8c9297431d467f7c94e..c14f6b9f63c23dcc417cc561d7ee65060613eee5 100644 (file)
@@ -276,7 +276,6 @@ along with GCC; see the file COPYING3.  If not see
          /* All unswitching, final value replacement and splitting can expose
             empty loops.  Remove them now.  */
          NEXT_PASS (pass_cd_dce);
-         NEXT_PASS (pass_record_bounds);
          NEXT_PASS (pass_iv_canon);
          NEXT_PASS (pass_loop_distribution);
          NEXT_PASS (pass_copy_prop);
index a0c2723d6cf9f5a4a6a2f4565ac192d4dfa53d09..f6b56ad5742d6d2da0cb0bbe1aac85a1283491f7 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-16  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/81090
+       * gcc.dg/graphite/pr81090.c: New testcase.
+
 2017-06-16  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/80983
diff --git a/gcc/testsuite/gcc.dg/graphite/pr81090.c b/gcc/testsuite/gcc.dg/graphite/pr81090.c
new file mode 100644 (file)
index 0000000..b5ebd43
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+int x3, za;
+int hg[1];
+
+void
+yw (int dq)
+{
+  const int r7 = 2;
+
+  while (dq < 1)
+    {
+      for (x3 = 0; x3 < r7; ++x3)
+       for (za = 0; za < r7; ++za)
+         hg[1] = 0;
+      ++dq;
+    }
+
+  x3 = 0;
+  while (x3 < r7)
+    {
+      ++x3;
+      if (x3 == 0)
+       break;
+    }
+}
index 0f7d936e64bd507ccb429801ca78a348b110f691..2863f769610891405d713fac049506b233d0830f 100644 (file)
@@ -373,7 +373,6 @@ extern gimple_opt_pass *make_pass_predcom (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_iv_canon (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_scev_cprop (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_empty_loop (gcc::context *ctxt);
-extern gimple_opt_pass *make_pass_record_bounds (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_graphite (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_graphite_transforms (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_if_conversion (gcc::context *ctxt);
index 95f65b042b72a0f4103e14c6385645fb2e842209..8459793a01b390b2e76fc3d0573020167539aeda 100644 (file)
@@ -3636,6 +3636,7 @@ scev_finalize (void)
     return;
   scalar_evolution_info->empty ();
   scalar_evolution_info = NULL;
+  free_numbers_of_iterations_estimates (cfun);
 }
 
 /* Returns true if the expression EXPR is considered to be too expensive
index 91787af257cd308dd6a2f4960f09a0d777ebb32d..f4ebe4837e09f0b309289e2b80c5591d320e8d8d 100644 (file)
@@ -1212,7 +1212,6 @@ canonicalize_induction_variables (void)
   bool irred_invalidated = false;
   bitmap loop_closed_ssa_invalidated = BITMAP_ALLOC (NULL);
 
-  free_numbers_of_iterations_estimates (cfun);
   estimate_numbers_of_iterations ();
 
   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
@@ -1230,6 +1229,7 @@ canonicalize_induction_variables (void)
 
   /* Clean up the information about numbers of iterations, since brute force
      evaluation could reveal new information.  */
+  free_numbers_of_iterations_estimates (cfun);
   scev_reset ();
 
   if (!bitmap_empty_p (loop_closed_ssa_invalidated))
index 10c43f32ba38764dc905cb53ecaea6c49bbeeb43..19a0f30c525cc98a0eb9ddd7c70712e88f94180c 100644 (file)
@@ -459,54 +459,6 @@ make_pass_scev_cprop (gcc::context *ctxt)
   return new pass_scev_cprop (ctxt);
 }
 
-/* Record bounds on numbers of iterations of loops.  */
-
-namespace {
-
-const pass_data pass_data_record_bounds =
-{
-  GIMPLE_PASS, /* type */
-  "*record_bounds", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  TV_TREE_LOOP_BOUNDS, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_record_bounds : public gimple_opt_pass
-{
-public:
-  pass_record_bounds (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_record_bounds, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual unsigned int execute (function *);
-
-}; // class pass_record_bounds
-
-unsigned int
-pass_record_bounds::execute (function *fun)
-{
-  if (number_of_loops (fun) <= 1)
-    return 0;
-
-  estimate_numbers_of_iterations ();
-  scev_reset ();
-  return 0;
-}
-
-} // anon namespace
-
-gimple_opt_pass *
-make_pass_record_bounds (gcc::context *ctxt)
-{
-  return new pass_record_bounds (ctxt);
-}
-
 /* Induction variable optimizations.  */
 
 namespace {