Skip to content

Commit c088b6a

Browse files
committed
[VPlan] Improve code in VPlanPredicator (NFC)
1 parent 7355ea3 commit c088b6a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ VPValue *VPPredicator::createBlockInMask(VPBasicBlock *VPBB) {
133133
// load/store/gather/scatter. Initialize BlockMask to no-mask.
134134
VPValue *BlockMask = nullptr;
135135
// This is the block mask. We OR all unique incoming edges.
136-
for (auto *Predecessor : SetVector<VPBlockBase *>(
137-
VPBB->getPredecessors().begin(), VPBB->getPredecessors().end())) {
136+
for (auto *Predecessor : make_range(VPBB->getPredecessors().begin(),
137+
unique(VPBB->getPredecessors()))) {
138138
VPValue *EdgeMask = createEdgeMask(cast<VPBasicBlock>(Predecessor), VPBB);
139139
if (!EdgeMask) { // Mask of predecessor is all-one so mask of block is
140140
// too.
@@ -184,8 +184,7 @@ void VPPredicator::createSwitchEdgeMasks(VPInstruction *SI) {
184184
VPValue *Cond = SI->getOperand(0);
185185
VPBasicBlock *DefaultDst = cast<VPBasicBlock>(Src->getSuccessors()[0]);
186186
MapVector<VPBasicBlock *, SmallVector<VPValue *>> Dst2Compares;
187-
for (const auto &[Idx, Succ] :
188-
enumerate(ArrayRef(Src->getSuccessors()).drop_front())) {
187+
for (const auto &[Idx, Succ] : enumerate(drop_begin(Src->getSuccessors()))) {
189188
VPBasicBlock *Dst = cast<VPBasicBlock>(Succ);
190189
assert(!getEdgeMask(Src, Dst) && "Edge masks already created");
191190
// Cases whose destination is the same as default are redundant and can
@@ -206,7 +205,7 @@ void VPPredicator::createSwitchEdgeMasks(VPInstruction *SI) {
206205
// cases with destination == Dst are taken. Join the conditions for each
207206
// case whose destination == Dst using an OR.
208207
VPValue *Mask = Conds[0];
209-
for (VPValue *V : ArrayRef<VPValue *>(Conds).drop_front())
208+
for (VPValue *V : drop_begin(Conds))
210209
Mask = Builder.createOr(Mask, V);
211210
if (SrcMask)
212211
Mask = Builder.createLogicalAnd(SrcMask, Mask);

0 commit comments

Comments
 (0)