Skip to content

Commit

Permalink
LV: change name of lambda; address review
Browse files Browse the repository at this point in the history
  • Loading branch information
artagnon committed May 30, 2024
1 parent 9ec07e7 commit 5421b68
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4883,8 +4883,9 @@ bool LoopVectorizationPlanner::isMoreProfitable(
if (!MaxTripCount)
return CmpFn(CostA * EstimatedWidthB, CostB * EstimatedWidthA);

auto GetCost = [MaxTripCount, this](unsigned VF, InstructionCost VectorCost,
InstructionCost ScalarCost) {
auto GetCostForTC = [MaxTripCount, this](unsigned VF,
InstructionCost VectorCost,
InstructionCost ScalarCost) {
// If the trip count is a known (possibly small) constant, the trip count
// will be rounded up to an integer number of iterations under
// FoldTailByMasking. The total cost in that case will be
Expand All @@ -4898,8 +4899,8 @@ bool LoopVectorizationPlanner::isMoreProfitable(
return VectorCost * (MaxTripCount / VF) + ScalarCost * (MaxTripCount % VF);
};

auto RTCostA = GetCost(EstimatedWidthA, CostA, A.ScalarCost);
auto RTCostB = GetCost(EstimatedWidthB, CostB, B.ScalarCost);
auto RTCostA = GetCostForTC(EstimatedWidthA, CostA, A.ScalarCost);
auto RTCostB = GetCostForTC(EstimatedWidthB, CostB, B.ScalarCost);
return CmpFn(RTCostA, RTCostB);
}

Expand Down

0 comments on commit 5421b68

Please sign in to comment.