diff options
author | jingyu <jingyu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-08 18:16:57 +0000 |
---|---|---|
committer | jingyu <jingyu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-08 18:16:57 +0000 |
commit | fd731bfb1dfe0d6b125b85c784f353228b242f09 (patch) | |
tree | 06ba5a757773ce104bb48ef3ccbaae8c74222aaa /gcc/tree-ssa-loop-unswitch.c | |
parent | b01e3c9b070c5c767aa625572fa1972da0691b07 (diff) | |
download | gcc-fd731bfb1dfe0d6b125b85c784f353228b242f09.tar.gz |
Fix a problematic logic at unswitch-loops pass.
2010-04-07 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).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158138 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-unswitch.c')
-rw-r--r-- | gcc/tree-ssa-loop-unswitch.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index 5b9ba90469c..bb3b1a5f40a 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -88,6 +88,26 @@ tree_ssa_unswitch_loops (void) /* 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); } @@ -189,31 +209,6 @@ tree_unswitch_single_loop (struct loop *loop, int num) 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); |