Skip to content

Commit 67135c3

Browse files
committed
add the some comments
1 parent 969366d commit 67135c3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,15 @@ InstructionCost VPWidenIntrinsicRecipe::computeCost(ElementCount VF,
10341034
// TODO: Rework TTI interface to be independent of concrete IR values.
10351035
SmallVector<const Value *> Arguments;
10361036

1037-
// VP Intrinsics should have the same cost as their non-vp counterpart.
1037+
// In fact, we need to get the VP intrinsics cost from the TTI, but currently
1038+
// the legacy model, it will always calculate cost of the call Intrinsics, eg:
1039+
// llvm.ctlz/llvm.smax, so VP Intrinsics should have the same cost as their
1040+
// non-vp counterpart.
1041+
// TODO: Use VP intrinsics to calculate the cost, if the following conditions
1042+
// are met
1043+
// 1. We don't need to compare to the legacy cost model
1044+
// 2. The cost model of VP is gradually improved in TTI
1045+
// 3. VPlan can set accurate CostAttrs’s parameters
10381046
Intrinsic::ID FID = VectorIntrinsicID;
10391047
unsigned NumOperands = getNumOperands();
10401048
const_operand_range arg_operands =
@@ -1045,7 +1053,7 @@ InstructionCost VPWidenIntrinsicRecipe::computeCost(ElementCount VF,
10451053
if (ID) {
10461054
FID = ID.value();
10471055
NumOperands = getNumOperands() - 1;
1048-
// Remove the EVL
1056+
// Remove the EVL from arg_operands
10491057
arg_operands = make_range(op_begin(), op_begin() + getNumOperands() - 1);
10501058
}
10511059
}

0 commit comments

Comments
 (0)