File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -962,8 +962,9 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
962
962
return InstructionsState::invalid();
963
963
}
964
964
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);
967
968
if (!I)
968
969
continue;
969
970
@@ -999,7 +1000,7 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
999
1000
continue;
1000
1001
}
1001
1002
}
1002
- } else if (auto *Inst = dyn_cast<CmpInst>(VL[Cnt] ); Inst && IsCmpOp) {
1003
+ } else if (auto *Inst = dyn_cast<CmpInst>(I ); Inst && IsCmpOp) {
1003
1004
auto *BaseInst = cast<CmpInst>(MainOp);
1004
1005
Type *Ty0 = BaseInst->getOperand(0)->getType();
1005
1006
Type *Ty1 = Inst->getOperand(0)->getType();
@@ -1014,7 +1015,7 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
1014
1015
CmpInst::Predicate SwappedCurrentPred =
1015
1016
CmpInst::getSwappedPredicate(CurrentPred);
1016
1017
1017
- if ((E == 2 || SwappedPredsCompatible) &&
1018
+ if ((VL.size() == 2 || SwappedPredsCompatible) &&
1018
1019
(BasePred == CurrentPred || BasePred == SwappedCurrentPred))
1019
1020
continue;
1020
1021
You can’t perform that action at this time.
0 commit comments