Page MenuHomePhabricator

[X86] Allow X86ISD::Wrapper to be folded into the base of gather/scatter address
ClosedPublic

Authored by craig.topper on Nov 10 2017, 3:26 PM.

Details

Summary

If the base of our gather corresponds to something contained in X86ISD::Wrapper we should be able to fold it into the address.

This patch refactors some of the address matching to more fully use the X86ISelAddressMode struct and the getAddressOperands helper. A new helper function matchVectorAddress is added to call matchWrapper or fall back to matchAddressBase.

We should also be able to support constant offsets from a wrapper, but I'll look into that in a future patch. We may even be able to completely reuse matchAddress here, but I wanted to start simple and work up to it.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Nov 10 2017, 3:26 PM
delena added inline comments.Nov 11 2017, 12:14 PM
lib/Target/X86/X86ISelDAGToDAG.cpp
1513 ↗(On Diff #122541)

Do you have an example when the Wrapper is not matched?

1548 ↗(On Diff #122541)

{} format

1549 ↗(On Diff #122541)

Could you, please, add a comment that explains what does "matchVectorAddress" mean?

craig.topper added inline comments.Nov 11 2017, 1:43 PM
lib/Target/X86/X86ISelDAGToDAG.cpp
1513 ↗(On Diff #122541)

I think right now the only way that can happen is if the codemodel is not small or kernel. Do you want me to add a test?

1548 ↗(On Diff #122541)

What's wrong with the formatting? Do you want the curly braces on the if removed? Or did you want me to merge the else and the "if (matchVectorAddress"

Add a large code model test. Merge 'else' and 'if (matchVectorAddress". Add a comment.

delena accepted this revision.Nov 13 2017, 1:49 AM
This revision is now accepted and ready to land.Nov 13 2017, 1:49 AM
This revision was automatically updated to reflect the committed changes.