diff --git a/llvm/include/llvm/Support/InstructionCost.h b/llvm/include/llvm/Support/InstructionCost.h --- a/llvm/include/llvm/Support/InstructionCost.h +++ b/llvm/include/llvm/Support/InstructionCost.h @@ -27,7 +27,7 @@ class InstructionCost { public: - using CostType = int; + using CostType = int64_t; /// These states can currently be used to indicate whether a cost is valid or /// invalid. Examples of an invalid cost might be where the cost is diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -6020,8 +6020,8 @@ bool LoopVectorizationCostModel::isMoreProfitable( const VectorizationFactor &A, const VectorizationFactor &B) const { - InstructionCost::CostType CostA = *A.Cost.getValue(); - InstructionCost::CostType CostB = *B.Cost.getValue(); + InstructionCost CostA = A.Cost; + InstructionCost CostB = B.Cost; unsigned MaxTripCount = PSE.getSE()->getSmallConstantMaxTripCount(TheLoop); @@ -6034,8 +6034,8 @@ // be PerIterationCost*floor(TC/VF) + Scalar remainder cost, and so is // approximated with the per-lane cost below instead of using the tripcount // as here. - int64_t RTCostA = CostA * divideCeil(MaxTripCount, A.Width.getFixedValue()); - int64_t RTCostB = CostB * divideCeil(MaxTripCount, B.Width.getFixedValue()); + auto RTCostA = CostA * divideCeil(MaxTripCount, A.Width.getFixedValue()); + auto RTCostB = CostB * divideCeil(MaxTripCount, B.Width.getFixedValue()); return RTCostA < RTCostB; } @@ -6595,7 +6595,7 @@ // A lambda that gets the register usage for the given type and VF. const auto &TTICapture = TTI; - auto GetRegUsage = [&TTICapture](Type *Ty, ElementCount VF) { + auto GetRegUsage = [&TTICapture](Type *Ty, ElementCount VF) -> int64_t { if (Ty->isTokenTy() || !VectorType::isValidElementType(Ty)) return 0; return *TTICapture.getRegUsageForType(VectorType::get(Ty, VF)).getValue();