This is an archive of the discontinued LLVM Phabricator instance.

[VPlan] Add VFRange::begin() and end() iterators. (NFCI)
ClosedPublic

Authored by fhahn on Apr 3 2023, 1:41 PM.

Details

Summary

Add an iterator to iterate over all VFs in VFRange. This simplifies some
existing code and allows using all_of,any_of and none_of on a VFRange.

Diff Detail

Event Timeline

fhahn created this revision.Apr 3 2023, 1:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2023, 1:41 PM
fhahn requested review of this revision.Apr 3 2023, 1:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2023, 1:41 PM
Ayal accepted this revision.Apr 7 2023, 1:24 PM

Nice cleanup, minor nits.

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

nit (Independent of this patch): can iterate over entire Range, rather than excluding its start element.

8898

nit (here and below): are the parentheses needed?

llvm/lib/Transforms/Vectorize/VPlan.h
125

TODO: instead of implicitly bumping End to next power-of-2 here, set it to MaxVFTimesTwo originally instead of MaxVFPlusOne and assert both Start and End are powers-of-two upon construction above?

This revision is now accepted and ready to land.Apr 7 2023, 1:24 PM
This revision was landed with ongoing or failed builds.Apr 8 2023, 2:25 AM
This revision was automatically updated to reflect the committed changes.
fhahn marked 3 inline comments as done.Apr 8 2023, 5:07 AM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8052

Excluding the start seems to be a minor optimization. I can remove it, but not sure if it improves things by much?

8898

Remove all these in the committed version, thanks!

llvm/lib/Transforms/Vectorize/VPlan.h
125

This should be done in c7a34d355a61396d438ea095e1e6996cde1ef880, thanks!