[llvm] 5e19208 - [InstructionCost] NFC: Fix up missing cases in LoopVectorize and CodeGenPrep.

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 06:31:28 PST 2021


Author: Sander de Smalen
Date: 2021-02-24T14:30:03Z
New Revision: 5e19208d96dda06327b7e17ae17a86049475f111

URL: https://github.com/llvm/llvm-project/commit/5e19208d96dda06327b7e17ae17a86049475f111
DIFF: https://github.com/llvm/llvm-project/commit/5e19208d96dda06327b7e17ae17a86049475f111.diff

LOG: [InstructionCost] NFC: Fix up missing cases in LoopVectorize and CodeGenPrep.

This fixes the types of a few more cost variables to be of type InstructionCost.

Added: 
    

Modified: 
    llvm/lib/CodeGen/CodeGenPrepare.cpp
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 6f9475da8c0a..f81d0971b4c5 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -6970,9 +6970,9 @@ class VectorPromoteHelper {
     // The scalar chain of computation has to pay for the transition
     // scalar to vector.
     // The vector chain has to account for the combining cost.
-    uint64_t ScalarCost =
+    InstructionCost ScalarCost =
         TTI.getVectorInstrCost(Transition->getOpcode(), PromotedType, Index);
-    uint64_t VectorCost = StoreExtractCombineCost;
+    InstructionCost VectorCost = StoreExtractCombineCost;
     enum TargetTransformInfo::TargetCostKind CostKind =
       TargetTransformInfo::TCK_RecipThroughput;
     for (const auto &Inst : InstsToBePromoted) {

diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 62e80cc9de59..ead0c6103bb8 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6811,7 +6811,7 @@ InstructionCost LoopVectorizationCostModel::getReductionPatternCost(
       unsigned ExtCost =
           TTI.getCastInstrCost(Op0->getOpcode(), VectorTy, ExtType,
                                TTI::CastContextHint::None, CostKind, Op0);
-      unsigned MulCost =
+      InstructionCost MulCost =
           TTI.getArithmeticInstrCost(Mul->getOpcode(), VectorTy, CostKind);
 
       InstructionCost RedCost = TTI.getExtendedAddReductionCost(
@@ -6821,7 +6821,7 @@ InstructionCost LoopVectorizationCostModel::getReductionPatternCost(
       if (RedCost.isValid() && RedCost < ExtCost * 2 + MulCost + BaseCost)
         return I == RetI ? *RedCost.getValue() : 0;
     } else {
-      unsigned MulCost =
+      InstructionCost MulCost =
           TTI.getArithmeticInstrCost(Mul->getOpcode(), VectorTy, CostKind);
 
       InstructionCost RedCost = TTI.getExtendedAddReductionCost(


        


More information about the llvm-commits mailing list