This is an archive of the discontinued LLVM Phabricator instance.

[X86] Various improvements to our vector splitting helpers for lowering. NFC
ClosedPublic

Authored by craig.topper on Apr 14 2020, 6:22 PM.

Details

Summary

-Consistently name the functions as split*
-Add a helper for doing the two extractSubvector calls and determining the size of the split
-Use getSplitDestVTs to get the result type for the split node.
-Move the binary and unary helper to one place in the file near the extractSubvector functions. Left the VSETCC one near LowerVSETCC since that's its only caller.
-Remove the 256/512 wrappers that just had asserts. I don't think they provided a lot of value and now with the routines called split* the call sites are more obvious what they do.
-Make the unary routine support different source and dest types to support D76212.
-Add some weaker asserts into the helpers to make up for losing the very specific asserts from the 256/512 wrappers.

Diff Detail

Event Timeline

craig.topper created this revision.Apr 14 2020, 6:22 PM
craig.topper retitled this revision from [X86] Various improvements to our vector splitting helpers for lowering to [X86] Various improvements to our vector splitting helpers for lowering. NFC.Apr 14 2020, 6:22 PM

Thanks for the cleanup!

llvm/lib/Target/X86/X86ISelLowering.cpp
5814

Can we trust SelectionDAG::SplitVector instead do you think? I noticed LowerTRUNCATE is using it.

craig.topper marked an inline comment as done.Apr 15 2020, 8:32 AM
craig.topper added inline comments.
llvm/lib/Target/X86/X86ISelLowering.cpp
5814

I think we might need the build_vector special case in extractSubvector. I tried to remove that special case years ago and got regressions. Though I guess I don’t know if those were from splitting or other callers of extractSubvector. So there were cases where the split build_vector needs to appear in the same lowering phase that calls the extract.

I think the case in LowerTRUNCATE is during type legalization. Type legalization of nodes isn’t dependent on surrounding nodes so early extracting of build_vector isn’t important. The next DAG combine should take care of it.

RKSimon accepted this revision.Apr 15 2020, 9:04 AM

Fair enough, LGTM - cheers

This revision is now accepted and ready to land.Apr 15 2020, 9:04 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2020, 11:31 AM