From: Richard Biener Date: Fri, 16 Jun 2017 12:19:24 +0000 (+0000) Subject: re PR tree-optimization/81090 ([graphite] ICE in loop_preheader_edge) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=01f1c24e423755d237e6c13ff81da1356b153caa;p=gcc.git re PR tree-optimization/81090 ([graphite] ICE in loop_preheader_edge) 2017-06-16 Richard Biener 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. From-SVN: r249249 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 258f6cb9869..b55b0cecd7a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2017-06-16 Richard Biener + + 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 * tree-switch-conversion.c (emit_case_bit_tests): Adjust diff --git a/gcc/passes.def b/gcc/passes.def index 25e9d974bc8..c14f6b9f63c 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a0c2723d6cf..f6b56ad5742 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-06-16 Richard Biener + + PR tree-optimization/81090 + * gcc.dg/graphite/pr81090.c: New testcase. + 2017-06-16 Janus Weil 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 index 00000000000..b5ebd43a91f --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr81090.c @@ -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; + } +} diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 0f7d936e64b..2863f769610 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -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); diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 95f65b042b7..8459793a01b 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -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 diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index 91787af257c..f4ebe4837e0 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -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)) diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c index 10c43f32ba3..19a0f30c525 100644 --- a/gcc/tree-ssa-loop.c +++ b/gcc/tree-ssa-loop.c @@ -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 {