[VPlan] Improve code in VPlanPredicator (NFC) (#150416)
This commit is contained in:
parent
2b1ce25e21
commit
7392131acf
@ -184,8 +184,7 @@ void VPPredicator::createSwitchEdgeMasks(VPInstruction *SI) {
|
||||
VPValue *Cond = SI->getOperand(0);
|
||||
VPBasicBlock *DefaultDst = cast<VPBasicBlock>(Src->getSuccessors()[0]);
|
||||
MapVector<VPBasicBlock *, SmallVector<VPValue *>> Dst2Compares;
|
||||
for (const auto &[Idx, Succ] :
|
||||
enumerate(ArrayRef(Src->getSuccessors()).drop_front())) {
|
||||
for (const auto &[Idx, Succ] : enumerate(drop_begin(Src->getSuccessors()))) {
|
||||
VPBasicBlock *Dst = cast<VPBasicBlock>(Succ);
|
||||
assert(!getEdgeMask(Src, Dst) && "Edge masks already created");
|
||||
// Cases whose destination is the same as default are redundant and can
|
||||
@ -206,7 +205,7 @@ void VPPredicator::createSwitchEdgeMasks(VPInstruction *SI) {
|
||||
// cases with destination == Dst are taken. Join the conditions for each
|
||||
// case whose destination == Dst using an OR.
|
||||
VPValue *Mask = Conds[0];
|
||||
for (VPValue *V : ArrayRef<VPValue *>(Conds).drop_front())
|
||||
for (VPValue *V : drop_begin(Conds))
|
||||
Mask = Builder.createOr(Mask, V);
|
||||
if (SrcMask)
|
||||
Mask = Builder.createLogicalAnd(SrcMask, Mask);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user