Page MenuHomePhabricator

[SLP]Improve cost estimation/emission of externally used extractelements.
ClosedPublic

Authored by ABataev on May 21 2021, 10:15 AM.

Details

Summary

No need to recalculate the cost of extractelements, just no need to
compensate the cost of all extractelements, need to check before if this
is actually going to be removed at the vectorization. Also, no need to
generate new extractelement instruction, we may just regenerate the
original one. It may improve the final vectorization.

Diff Detail

Event Timeline

ABataev created this revision.May 21 2021, 10:15 AM
ABataev requested review of this revision.May 21 2021, 10:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2021, 10:15 AM
RKSimon edited the summary of this revision. (Show Details)May 21 2021, 10:36 AM
RKSimon added inline comments.May 21 2021, 10:38 AM
llvm/test/Transforms/SLPVectorizer/X86/extractelement.ll
80 ↗(On Diff #347071)

this looks like a NFC regeneration?

ABataev added inline comments.May 21 2021, 10:40 AM
llvm/test/Transforms/SLPVectorizer/X86/extractelement.ll
80 ↗(On Diff #347071)

Not quite, the order of extractelements has changed

ABataev added inline comments.May 21 2021, 11:00 AM
llvm/test/Transforms/SLPVectorizer/X86/extractelement.ll
80 ↗(On Diff #347071)

I will investigate why it happens.

ABataev updated this revision to Diff 347106.May 21 2021, 12:57 PM

Rebase + rework.

ABataev retitled this revision from [SLP]Fix cost/emission of externally used extractelements. to [SLP]Improve cost estimation/emission of externally used extractelements..May 21 2021, 12:58 PM
ABataev edited the summary of this revision. (Show Details)

Reworked the patch, had to make changes for the vectorizable extractelements compensation cost. Also, we were not quite correct when trying to check for the vectorized users, need to check also if the instruction is going to be vectorized as a reduction value. Otherwise we could be too optimistic in non-reduction cases (when extractelements are the seeds and their user is not actually in the vectorization graph).

RKSimon accepted this revision.Jun 3 2021, 4:26 AM

LGTM

This revision is now accepted and ready to land.Jun 3 2021, 4:26 AM