+ return canonicalize_induction_variables ();
+}
+
+static bool
+gate_tree_ssa_loop_ivcanon (void)
+{
+ return flag_tree_loop_ivcanon != 0;
+}
+
+struct gimple_opt_pass pass_iv_canon =
+{
+ {
+ GIMPLE_PASS,
+ "ivcanon", /* name */
+ gate_tree_ssa_loop_ivcanon, /* gate */
+ tree_ssa_loop_ivcanon, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_TREE_LOOP_IVCANON, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+ }
+};
+
+/* Propagation of constants using scev. */
+
+static bool
+gate_scev_const_prop (void)
+{
+ return flag_tree_scev_cprop;
+}
+
+struct gimple_opt_pass pass_scev_cprop =
+{
+ {
+ GIMPLE_PASS,
+ "sccp", /* name */
+ gate_scev_const_prop, /* gate */
+ scev_const_prop, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_SCEV_CONST, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func | TODO_cleanup_cfg
+ | TODO_update_ssa_only_virtuals
+ /* todo_flags_finish */
+ }
+};
+
+/* Record bounds on numbers of iterations of loops. */
+
+static unsigned int
+tree_ssa_loop_bounds (void)
+{
+ if (number_of_loops () <= 1)
+ return 0;
+
+ estimate_numbers_of_iterations ();
+ scev_reset ();
+ return 0;
+}
+
+struct gimple_opt_pass pass_record_bounds =
+{
+ {
+ GIMPLE_PASS,
+ "*record_bounds", /* name */
+ NULL, /* gate */
+ tree_ssa_loop_bounds, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 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 */
+ }
+};
+
+/* Complete unrolling of loops. */
+
+static unsigned int
+tree_complete_unroll (void)
+{
+ if (number_of_loops () <= 1)
+ return 0;
+
+ return tree_unroll_loops_completely (flag_unroll_loops
+ || flag_peel_loops
+ || optimize >= 3, true);
+}
+
+static bool
+gate_tree_complete_unroll (void)
+{
+ return true;
+}
+
+struct gimple_opt_pass pass_complete_unroll =
+{
+ {
+ GIMPLE_PASS,
+ "cunroll", /* name */
+ gate_tree_complete_unroll, /* gate */
+ tree_complete_unroll, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_COMPLETE_UNROLL, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func
+ | TODO_ggc_collect /* todo_flags_finish */
+ }
+};
+
+/* Complete unrolling of inner loops. */
+
+static unsigned int
+tree_complete_unroll_inner (void)
+{
+ unsigned ret = 0;
+
+ loop_optimizer_init (LOOPS_NORMAL
+ | LOOPS_HAVE_RECORDED_EXITS);
+ if (number_of_loops () > 1)