Page MenuHomePhabricator

[SLP] Honor min/max regsize and min/max VF in vectorizeStores
ClosedPublic

Authored by bjope on Mar 1 2021, 7:49 AM.

Details

Summary

Make sure we use PowerOf2Floor instead of PowerOf2Ceil when
calculating max number of elements that fits inside a vector
register (otherwise we could end up creating vectors larger
than the maximum vector register size).

Also make sure we honor the min/max VF (as given by TTI or
cmd line parameters) when doing vectorizeStores.

Diff Detail

Event Timeline

bjope created this revision.Mar 1 2021, 7:49 AM
bjope requested review of this revision.Mar 1 2021, 7:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2021, 7:49 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6157

Good fix, how did we missed this? Looks like ceil and floor are equal in real life here.

6162

Since llvm::PowerOf2Floor() could return 0 for zero argument, I believe this check could be actually removed.

LGTM except for the comment. I think MaxVecRegSize % EltSize != 0 check could be removed (together with comment).

This revision was not accepted when it landed; it landed in state Needs Review.Mon, Mar 22, 9:30 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.