[PATCH] D147468: [VPlan] Add VFRange::begin() and end() iterators. (NFCI)
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 7 13:24:39 PDT 2023
Ayal accepted this revision.
Ayal added a comment.
This revision is now accepted and ready to land.
Nice cleanup, minor nits.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8052
- for (ElementCount TmpVF = Range.Start * 2;
- ElementCount::isKnownLT(TmpVF, Range.End); TmpVF *= 2)
+ for (ElementCount TmpVF : VFRange(Range.Start * 2, Range.End))
if (Predicate(TmpVF) != PredicateAtRangeStart) {
----------------
nit (Independent of this patch): can iterate over entire Range, rather than excluding its start element.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8898
bool IVUpdateMayOverflow = false;
- for (ElementCount VF = Range.Start;
- ElementCount::isKnownLT(VF, Range.End); VF *= 2)
+ for (ElementCount VF : Range) {
IVUpdateMayOverflow |= !isIndvarOverflowCheckKnownFalse(&CM, VF);
----------------
nit (here and below): are the parentheses needed?
================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:125
+ ElementCount EndVF = End;
+ // Make sure the end iterator is a power-of-2 so != comparisons with end work as expected.
+ if (!isPowerOf2_64(End.getKnownMinValue()))
----------------
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?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147468/new/
https://reviews.llvm.org/D147468
More information about the llvm-commits
mailing list