diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-02 11:59:47 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-02 11:59:47 +0000 |
commit | 759626e64ff15d51cb12ec351d3a0de0b06ae13e (patch) | |
tree | 2530310032c7350590cc31435d505a64dae7572b /gcc/loop-init.c | |
parent | 2a9b01cb49d882a1c627b130572b408c529e9989 (diff) | |
download | gcc-759626e64ff15d51cb12ec351d3a0de0b06ae13e.tar.gz |
2012-04-02 Richard Guenther <rguenther@suse.de>
PR middle-end/52803
* loop-init.c (gate_handle_loop2): Destroy loops here if
we don't enter RTL loop optimizers.
* gcc.dg/pr52803.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186080 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-init.c')
-rw-r--r-- | gcc/loop-init.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/gcc/loop-init.c b/gcc/loop-init.c index b8d7b7ee7ce..03f8f610c97 100644 --- a/gcc/loop-init.c +++ b/gcc/loop-init.c @@ -158,15 +158,24 @@ loop_optimizer_finalize (void) static bool gate_handle_loop2 (void) { - return (optimize > 0 - && (flag_move_loop_invariants - || flag_unswitch_loops - || flag_peel_loops - || flag_unroll_loops + if (optimize > 0 + && (flag_move_loop_invariants + || flag_unswitch_loops + || flag_peel_loops + || flag_unroll_loops #ifdef HAVE_doloop_end - || (flag_branch_on_count_reg && HAVE_doloop_end) + || (flag_branch_on_count_reg && HAVE_doloop_end) #endif - )); + )) + return true; + else + { + /* No longer preserve loops, remove them now. */ + cfun->curr_properties &= ~PROP_loops; + if (current_loops) + loop_optimizer_finalize (); + return false; + } } struct rtl_opt_pass pass_loop2 = |