This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

loop unrolling performance regression


Hi,
I've been investigating futher the loop unrolling regression caused by Richard
fix and cleanup.  The problem I see is with loop like

loop_beg_note
loop_label:
..body..
if (test) goto skip
exit code
goto exit_label
skip:
goto loop_label
loop_end_note

The goto skip is forwarded to loop_label and resutling code is:

loop_beg_note
loop_label:
..body..
if (test) goto loop_beg_label
exit code
goto exit_label
loop_end_note

And the loop is ignored by loop optimizer as missformed one.

While the original code did jump optimized this special case by hand moving
the loop_end_note backward to re-construct proper loop.

I see three possible fixes:
1) re-incarante the ugly code to more loop_end_label around
2) teach delete_block to move loop_end note backward in such case
3) avoid forwarding of the jumps followed by loop_end note

The 3) looks most correct to me as it will solve problems with multiple
back edges that I beleive didn't happen in old jump implementation.

2) looks it can produce better code tought.  So I will try to prepare both
fixes and give it benchmark run.

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]