This is an archive of the discontinued LLVM Phabricator instance.

[LV] Fix FoldTail under user VF and UF
ClosedPublic

Authored by Ayal on May 17 2020, 8:40 AM.

Details

Summary

LV considers an internally computed MaxVF to decide if a constant trip-count is
a multiple of any subsequently chosen VF, and conclude that no scalar remainder
iterations (tail) will be left for FoldTail to handle. If an external VF is provided via
-force-vector-width, it must be considered instead of the internal MaxVF.
If an external UF is provided via -force-vector-interleave, it too must be
considered in addition to MaxVF or user VF.

Fixes PR45679.

Diff Detail

Event Timeline

Ayal created this revision.May 17 2020, 8:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 17 2020, 8:40 AM
fhahn accepted this revision.May 17 2020, 9:49 AM

LGTM, thanks! It could be beneficial to move the UserVF handling directly to computeFeasibleMaxVF (see inline comment), but either approach should be fine!

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
4968

It might be slightly better to have computeFeasibleMaxVF itself have a shortcut to return UserVF. That would potentially avoid missing the accounting for UserVF in new users of computeFeasibleMaxVF

This revision is now accepted and ready to land.May 17 2020, 9:49 AM

LGTM , too. Thanks for extending this feature.

This revision was automatically updated to reflect the committed changes.
Ayal added a comment.May 19 2020, 10:12 AM

LGTM, thanks! It could be beneficial to move the UserVF handling directly to computeFeasibleMaxVF (see inline comment), but either approach should be fine!

Yeah, thanks, considered that option. OTOH, seems logical to avoid calling computeFeasibleMaxVF() when nothing needs to be computed.