This is an archive of the discontinued LLVM Phabricator instance.

[NFC][TTI] Add/extract `getReplicationShuffleCost()` method, deduplicate it's implementations
ClosedPublic

Authored by lebedev.ri on Nov 5 2021, 12:46 PM.

Details

Summary

Hiding it in getInterleavedMemoryOpCost() is problematic for a number of reasons,
including testability and reuse, let's do better.

In a followup getUserCost() will be taught to use to to estimate the mask costs,
which will allow for better cost model tests for it.

Diff Detail

Event Timeline

lebedev.ri created this revision.Nov 5 2021, 12:46 PM
lebedev.ri requested review of this revision.Nov 5 2021, 12:46 PM

Is it due to this being mainly used for interleaved ops that you didn't integrate it into the ShuffleKind enum?

llvm/include/llvm/CodeGen/BasicTTIImpl.h
1117

Pass APInt args as const APInt &

lebedev.ri updated this revision to Diff 385201.Nov 5 2021, 3:14 PM
lebedev.ri marked an inline comment as done.

Is it due to this being mainly used for interleaved ops that you didn't integrate it into the ShuffleKind enum?

Basically yes. Then we'd always have to construct a shuffle mask,
only to then call ShuffleVectorInst::isReplicationMask() on it.
It just seems backwards.

D113324 is the only used that i plan on having.

lebedev.ri added inline comments.
llvm/include/llvm/CodeGen/BasicTTIImpl.h
1117

D'oh.

RKSimon accepted this revision.Nov 6 2021, 6:36 AM

LGTM

This revision is now accepted and ready to land.Nov 6 2021, 6:36 AM

LGTM

Thank you for the review.