Skip to content

Commit 2275840

Browse files
committed
Address review comment
1 parent 7a8a9b0 commit 2275840

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,12 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
10331033
// TODO: It may be possible to improve this by analyzing where the
10341034
// condition operand comes from.
10351035
CmpInst::Predicate Pred = CmpInst::BAD_ICMP_PREDICATE;
1036-
auto *CondTy = toVectorTy(Ctx.Types.inferScalarType(getOperand(0)), VF);
1037-
auto *VecTy = toVectorTy(Ctx.Types.inferScalarType(getOperand(1)), VF);
1036+
auto *CondTy = Ctx.Types.inferScalarType(getOperand(0));
1037+
auto *VecTy = Ctx.Types.inferScalarType(getOperand(1));
1038+
if (!vputils::onlyFirstLaneUsed(this)) {
1039+
CondTy = toVectorTy(CondTy, VF);
1040+
VecTy = toVectorTy(VecTy, VF);
1041+
}
10381042
return Ctx.TTI.getCmpSelInstrCost(Instruction::Select, VecTy, CondTy, Pred,
10391043
Ctx.CostKind);
10401044
}

0 commit comments

Comments
 (0)