This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/9319: slower code generated for simple loop on linux
> I don't think it's worth much time. The only way to Really Fix
> this is to move to CFG-based loop analysis.
Yes, and the pessimization is a direct effect of the patch, not a mere side
effect. Before, loops such as
top:
/* empty */
body:
if (!cond) goto end;
statement;
goto top;
end:
were rotated, identically to canonical loops such as
top:
if (!cond) goto end;
body:
statement;
goto top;
end:
into
goto first;
top:
statement;
first:
if (cond) goto top;
Now the patch explicitly forbids that, in order to preserve the unrolling
pass:
! We rely on the presence of NOTE_INSN_LOOP_END_TOP_COND to mark
! the end of the entry condtional. Without this, our lexical scan
! can't tell the difference between an entry conditional and a
! body conditional that exits the loop. Mistaking the two means
! that we can misplace the NOTE_INSN_LOOP_CONT note, which can
! screw up loop unrolling.
Would you support relaxing the code when unrolling is disabled, in order to
recover the optimization loss in that case ?
--
Eric Botcazou