+2010-04-08 Jing Yu <jingyu@google.com>
+ Zdenek Dvorak <ook@ucw.cz>
+
+ PR tree-optimization/42720
+ * tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Move one-time
+ loop unswitch conditions here from
+ (tree_unswitch_single_loop).
+
2010-04-08 Sebastian Pop <sebastian.pop@amd.com>
* tree-if-conv.c: Fix comments and simplify logic.
/* Go through inner loops (only original ones). */
FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
{
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; Considering loop %d\n", loop->num);
+
+ /* Do not unswitch in cold regions. */
+ if (optimize_loop_for_size_p (loop))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; Not unswitching cold loops\n");
+ continue;
+ }
+
+ /* The loop should not be too large, to limit code growth. */
+ if (tree_num_loop_insns (loop, &eni_size_weights)
+ > (unsigned) PARAM_VALUE (PARAM_MAX_UNSWITCH_INSNS))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; Not unswitching, loop too big\n");
+ continue;
+ }
+
changed |= tree_unswitch_single_loop (loop, 0);
}
return false;
}
- /* Only unswitch innermost loops. */
- if (loop->inner)
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, ";; Not unswitching, not innermost loop\n");
- return false;
- }
-
- /* Do not unswitch in cold regions. */
- if (optimize_loop_for_size_p (loop))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, ";; Not unswitching cold loops\n");
- return false;
- }
-
- /* The loop should not be too large, to limit code growth. */
- if (tree_num_loop_insns (loop, &eni_size_weights)
- > (unsigned) PARAM_VALUE (PARAM_MAX_UNSWITCH_INSNS))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, ";; Not unswitching, loop too big\n");
- return false;
- }
-
i = 0;
bbs = get_loop_body (loop);