aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-08-14 13:14:24 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-08-14 13:14:24 +0000
commit7d39012c24ded7a9d1d4eb1fa2916181dac3ada2 (patch)
tree41dc7049a44602f9a0155dd8016a9abe934679e6 /gcc/tree-ssa-loop.c
parent833f94c0119e638645a2adc461e385dc1ffc5e2b (diff)
downloadgcc-7d39012c24ded7a9d1d4eb1fa2916181dac3ada2.zip
gcc-7d39012c24ded7a9d1d4eb1fa2916181dac3ada2.tar.gz
gcc-7d39012c24ded7a9d1d4eb1fa2916181dac3ada2.tar.bz2
re PR tree-optimization/62081 (ICE: in fix_loop_structure, at loop-init.c:208 with -fno-tree-ch -fno-tree-cselim -fno-tree-dominator-opts -fno-tree-reassoc -fno-tree-sink)
2014-08-14 Richard Biener <rguenther@suse.de> PR tree-optimization/62081 * tree-ssa-loop.c (pass_fix_loops): New pass. (pass_tree_loop::gate): Do not fixup loops here. * tree-pass.h (make_pass_fix_loops): Declare. * passes.def: Schedule pass_fix_loops before GIMPLE loop passes. From-SVN: r213961
Diffstat (limited to 'gcc/tree-ssa-loop.c')
-rw-r--r--gcc/tree-ssa-loop.c53
1 files changed, 50 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index d0c9980..7d1f68e 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -43,6 +43,56 @@ along with GCC; see the file COPYING3. If not see
#include "tree-vectorizer.h"
+/* A pass making sure loops are fixed up. */
+
+namespace {
+
+const pass_data pass_data_fix_loops =
+{
+ GIMPLE_PASS, /* type */
+ "fix_loops", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ TV_TREE_LOOP, /* tv_id */
+ PROP_cfg, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+};
+
+class pass_fix_loops : public gimple_opt_pass
+{
+public:
+ pass_fix_loops (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_fix_loops, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ virtual bool gate (function *) { return flag_tree_loop_optimize; }
+
+ virtual unsigned int execute (function *fn);
+}; // class pass_fix_loops
+
+unsigned int
+pass_fix_loops::execute (function *)
+{
+ if (loops_state_satisfies_p (LOOPS_NEED_FIXUP))
+ {
+ calculate_dominance_info (CDI_DOMINATORS);
+ fix_loop_structure (NULL);
+ }
+ return 0;
+}
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_fix_loops (gcc::context *ctxt)
+{
+ return new pass_fix_loops (ctxt);
+}
+
+
/* Gate for loop pass group. The group is controlled by -ftree-loop-optimize
but we also avoid running it when the IL doesn't contain any loop. */
@@ -57,9 +107,6 @@ gate_loop (function *fn)
if (!loops_for_fn (fn))
return true;
- /* Make sure to drop / re-discover loops when necessary. */
- if (loops_state_satisfies_p (LOOPS_NEED_FIXUP))
- fix_loop_structure (NULL);
return number_of_loops (fn) > 1;
}