File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -721,19 +721,25 @@ Value *VPInstruction::generate(VPTransformState &State) {
721
721
InstructionCost VPInstruction::computeCost (ElementCount VF,
722
722
VPCostContext &Ctx) const {
723
723
if (Instruction::isBinaryOp (getOpcode ())) {
724
+
725
+ Type *ResTy = Ctx.Types .inferScalarType (this );
726
+ if (!vputils::onlyFirstLaneUsed (this ))
727
+ ResTy = toVectorTy (ResTy, VF);
728
+
724
729
if (!getUnderlyingValue ()) {
725
- // TODO: Compute cost for VPInstructions without underlying values once
726
- // the legacy cost model has been retired.
727
- return 0 ;
730
+ switch (getOpcode ()) {
731
+ case Instruction::FMul:
732
+ return Ctx.TTI .getArithmeticInstrCost (getOpcode (), ResTy, Ctx.CostKind );
733
+ default :
734
+ // TODO: Compute cost for VPInstructions without underlying values once
735
+ // the legacy cost model has been retired.
736
+ return 0 ;
737
+ }
728
738
}
729
739
730
740
assert (!doesGeneratePerAllLanes () &&
731
741
" Should only generate a vector value or single scalar, not scalars "
732
742
" for all lanes." );
733
- Type *ResTy = Ctx.Types .inferScalarType (this );
734
- if (!vputils::onlyFirstLaneUsed (this ))
735
- ResTy = toVectorTy (ResTy, VF);
736
-
737
743
return Ctx.TTI .getArithmeticInstrCost (getOpcode (), ResTy, Ctx.CostKind );
738
744
}
739
745
You can’t perform that action at this time.
0 commit comments