Skip to content

Commit 0a27e6d

Browse files
committed
skip the beginning PoisonValue
1 parent fb56951 commit 0a27e6d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,9 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
962962
return InstructionsState::invalid();
963963
}
964964
bool AnyPoison = InstCnt != VL.size();
965-
for (int Cnt = 0, E = VL.size(); Cnt < E; Cnt++) {
966-
auto *I = dyn_cast<Instruction>(VL[Cnt]);
965+
// Skip MainOp.
966+
while (++It != VL.end()) {
967+
auto *I = dyn_cast<Instruction>(*It);
967968
if (!I)
968969
continue;
969970

@@ -999,7 +1000,7 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
9991000
continue;
10001001
}
10011002
}
1002-
} else if (auto *Inst = dyn_cast<CmpInst>(VL[Cnt]); Inst && IsCmpOp) {
1003+
} else if (auto *Inst = dyn_cast<CmpInst>(I); Inst && IsCmpOp) {
10031004
auto *BaseInst = cast<CmpInst>(MainOp);
10041005
Type *Ty0 = BaseInst->getOperand(0)->getType();
10051006
Type *Ty1 = Inst->getOperand(0)->getType();
@@ -1014,7 +1015,7 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
10141015
CmpInst::Predicate SwappedCurrentPred =
10151016
CmpInst::getSwappedPredicate(CurrentPred);
10161017

1017-
if ((E == 2 || SwappedPredsCompatible) &&
1018+
if ((VL.size() == 2 || SwappedPredsCompatible) &&
10181019
(BasePred == CurrentPred || BasePred == SwappedCurrentPred))
10191020
continue;
10201021

0 commit comments

Comments
 (0)