Basic block reordering hampering do-loop conversion
Ian Lance Taylor
iant@google.com
Fri May 4 14:00:00 GMT 2012
Ayonam Ray <ayonam@gmail.com> writes:
> My architecture has a hardware loop implementation which works only if
> there are no conditional branches in the loop body. We have
> implemented the doloop_begin and doloop_end RTLs and also the target
> macro TARGET_INVALID_WITHIN_DOLOOP.
>
> The optimization works correctly except that in some cases the basic
> block reordering pass (and possibly some other passes) reorder the
> blocks in such a manner that the body of the loop no longer remains as
> a single basic block or even successive basic blocks that fall through
> to the next, even though the original code has no branches within the
> loop body.
>
> This makes the final code generation impossible since the doloop
> specific instructions can no longer be generated.
>
> Any suggestions at preventing the basic block reordering happening for
> such loops? We tried turning off the basic block reorder pass but
> then some other pass appears to still mess it up.
If you don't have any branches in the loop body then I'm not sure why
you get multiple basic blocks.
I don't know of any easy way to prevent the compiler from rearranging
basic blocks.
Ian
More information about the Gcc-help
mailing list