This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Improve cost of the gather nodes.
ClosedPublic

Authored by ABataev on Nov 12 2021, 6:49 AM.

Details

Summary

No need to count the final shuffle cost for the constants, gathering of
the constants is just a constant vector + extra inserts, if required.

Diff Detail

Event Timeline

ABataev created this revision.Nov 12 2021, 6:49 AM
ABataev requested review of this revision.Nov 12 2021, 6:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 12 2021, 6:49 AM
vporpo added inline comments.Nov 12 2021, 11:58 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
5606

Could you a comment here mentioning that gathering from constants does not need shuffles? Or perhaps make it more explicit by renaming this variable to GatherFromConstants = true and resetting it if any of the VL elements is not a constant?

ABataev added inline comments.Nov 12 2021, 12:22 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
5606

It is set not only if the value is not constant but also if the same value was already counter for gathering. Will rename to DuplicateNonConst

ABataev updated this revision to Diff 386921.Nov 12 2021, 12:25 PM

Address comments

vporpo accepted this revision.Nov 15 2021, 7:14 PM

LGTM

This revision is now accepted and ready to land.Nov 15 2021, 7:14 PM
This revision was automatically updated to reflect the committed changes.