This is an archive of the discontinued LLVM Phabricator instance.

[llvm][CodeGen] Fix issue for SVE gather prefetch.
ClosedPublic

Authored by fpetrogalli on Apr 13 2020, 5:53 PM.

Details

Summary

This change is fixing an issue where the dagcombine incorrectly used an addressing mode with scaled offsets (indices), instead of unscaled offsets.
Those addressing modes do not exist for prfh , prfw and prfd, hence we can reuse prfb because that has unscaled offsets, and because the pseudo-code in the XML spec suggests that the element size is not used for the amount of data that is prefetched by the instruction.

FWIW, GCC also emits a prfb for these cases.

Diff Detail

Event Timeline

fpetrogalli created this revision.Apr 13 2020, 5:53 PM
Herald added a project: Restricted Project. · View Herald Transcript
fpetrogalli edited the summary of this revision. (Show Details)Apr 15 2020, 3:36 PM

Reverting to the DAG Combine method instead of using tablegen patters, as agreed with @sdesmalen.

sdesmalen accepted this revision.Apr 16 2020, 2:18 PM

The patch LGTM.

I found the commit message quite confusing though. This is simply fixing an issue where the dagcombine incorrectly used an addressing mode with scaled offsets (indices), instead of unscaled offsets.
Because those addressing modes don't exist for prfh, prfw and prfd, we can reuse prfb because that has unscaled offsets, and because the pseudo-code in the XML spec suggests that the element size is not used for the amount of data that is prefetched by the instruction.

FWIW, GCC also emits a prfb for these cases.

This revision is now accepted and ready to land.Apr 16 2020, 2:18 PM
fpetrogalli edited the summary of this revision. (Show Details)Apr 16 2020, 7:59 PM

Thank you for the review @sdesmalen , I have updated the commit message stealing your comment!

Francesco

This revision was automatically updated to reflect the committed changes.