This is an archive of the discontinued LLVM Phabricator instance.

[X86] Prevent fast isel from folding loads into the instructions listed in hasPartialRegUpdate.
ClosedPublic

Authored by craig.topper on Oct 28 2017, 7:32 PM.

Details

Summary

This patch moves the check for opt size and hasPartialRegUpdate into the lower level implementation of foldMemoryOperandImpl to catch the entry point that fast isel uses.

We're still folding undef register instructions in AVX that we should also probably disable, but that's a problem for another patch.

Unfortunately, this requires reordering a bunch of functions which is why the diff is so large. I can do the function reordering separately if we want.

Event Timeline

craig.topper created this revision.Oct 28 2017, 7:32 PM
craig.topper edited the summary of this revision. (Show Details)Oct 28 2017, 7:33 PM
craig.topper added reviewers: RKSimon, spatel, zvi.
craig.topper added a subscriber: llvm-commits.
RKSimon edited edge metadata.Oct 29 2017, 4:24 AM

An NFC re-ordering of functions would make this a lot easier to see the relevant functional diffs.

Rebase after function reordering.

zvi edited edge metadata.Oct 30 2017, 3:14 AM

LGTM, with a minor concern that with this change FastISel is a bit slower because the bail-out condition was moved to a later point?

Do we have optsize/minsize tests for this anywhere?

I don't think this makes fast isel slower rather it make sure the fast isel entry point does this check. (at least the one used by X86FastISel::tryToFoldLoadIntoMI). So it actually may slow down peephole folding and spill folding. Maybe I should just leave the other checks in place and add a new one?

I'm not sure what tests we have for the optsize. I'm pretty sure we don't have any for fast isel but not sure about SDAG.

Replicate check instead of moving it. Add optsize fast-isel tests.

RKSimon accepted this revision.Nov 1 2017, 3:56 AM

LGTM - do we have a TODO/bug anywhere for the existing AVX issue?

This revision is now accepted and ready to land.Nov 1 2017, 3:56 AM
This revision was automatically updated to reflect the committed changes.