[llvm] 1ebc965 - [X86] getIntImmCostInst - silence static analyzer overflow warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 23 07:49:41 PDT 2023


Author: Simon Pilgrim
Date: 2023-07-23T15:49:33+01:00
New Revision: 1ebc965116a89036cf1a255893d67fac8e690bea

URL: https://github.com/llvm/llvm-project/commit/1ebc965116a89036cf1a255893d67fac8e690bea
DIFF: https://github.com/llvm/llvm-project/commit/1ebc965116a89036cf1a255893d67fac8e690bea.diff

LOG: [X86] getIntImmCostInst - silence static analyzer overflow warning. NFCI.

Use the divideCeil uint64_t return type directly

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86TargetTransformInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index 7dccb9161d5a77..201273a7ca40f4 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -5572,7 +5572,7 @@ InstructionCost X86TTIImpl::getIntImmCostInst(unsigned Opcode, unsigned Idx,
   }
 
   if (Idx == ImmIdx) {
-    int NumConstants = divideCeil(BitSize, 64);
+    uint64_t NumConstants = divideCeil(BitSize, 64);
     InstructionCost Cost = X86TTIImpl::getIntImmCost(Imm, Ty, CostKind);
     return (Cost <= NumConstants * TTI::TCC_Basic)
                ? static_cast<int>(TTI::TCC_Free)


        


More information about the llvm-commits mailing list