When a prefetch for a fixed location is encountered, it doesn't have any dependencies, causing it to be scheduled as the first instruction in the region. This can move it beyond the spawn instruction.
Solution: add dependency between the spawn and the prefetch instructions in the block.
Note: An attempt to handle some cases has been implemented, look in gcc-4.0.2/gcc/sched-rgn.c:1650. However, this doesn't work in all cases, it just prevents prefetches to be moved beyond a basic-block boundary. But when there is only one basic block in the region containing the spawn, it can be moved beyond the spawn.
The attached file, when compiled with linear prefetching enabled, exhibits this case.
Log in to post a comment.