Message ID | Pine.LNX.4.64.1204021139010.1852@jbgna.fhfr.qr |
---|---|
State | New |
Headers | show |
> > This fixes PR52803 - when we do not enter the pass_loop2 sub-pass > queue nothing will execute pass_rtl_loop_done. But we still need > to destroy loops, which are preserved until after pass_loop2. > Doing so in the gate of pass_loop2 is ugly, but destroyed > properties are ignored if the gate returns false. Another > solution would be to destroy loops earlier dependent on > gate_handle_loop2 - but that's equally ugly. Another solution > would be to add a pass after pass_loop2 that only destroys > loops (also ugly). > > Honza, how is this part of the pass manager supposed to work? Did not think of much of alternatives. We can have pass just after loop destroying the loop structure or perhaps we can simply run loop init/uninit always even if all the subpasses are disabled. Would be a bit smoother, but also wasteful. Honza
Index: gcc/loop-init.c =================================================================== --- gcc/loop-init.c (revision 186066) +++ gcc/loop-init.c (working copy) @@ -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 = Index: gcc/testsuite/gcc.dg/pr52803.c =================================================================== --- gcc/testsuite/gcc.dg/pr52803.c (revision 0) +++ gcc/testsuite/gcc.dg/pr52803.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-move-loop-invariants" } */ + +int main () { return 0; }