[llvm] 4e0c6d3 - Fix build warning caused by mixed signed/unsigned compare (#69797)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 16:42:45 PDT 2023


Author: Andy Kaylor
Date: 2023-10-20T16:42:41-07:00
New Revision: 4e0c6d30576ab10cf022b040c9441c2b5d0efb3c

URL: https://github.com/llvm/llvm-project/commit/4e0c6d30576ab10cf022b040c9441c2b5d0efb3c
DIFF: https://github.com/llvm/llvm-project/commit/4e0c6d30576ab10cf022b040c9441c2b5d0efb3c.diff

LOG: Fix build warning caused by mixed signed/unsigned compare (#69797)

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SimplifyIndVar.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 45cbdd235898b28..a23ac41acaa58aa 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -659,11 +659,11 @@ bool SimplifyIndvar::replaceFloatIVWithIntegerIV(Instruction *UseInst) {
   Instruction *IVOperand = cast<Instruction>(UseInst->getOperand(0));
   // Get the symbolic expression for this instruction.
   const SCEV *IV = SE->getSCEV(IVOperand);
-  unsigned MaskBits;
+  int MaskBits;
   if (UseInst->getOpcode() == CastInst::SIToFP)
-    MaskBits = SE->getSignedRange(IV).getMinSignedBits();
+    MaskBits = (int)SE->getSignedRange(IV).getMinSignedBits();
   else
-    MaskBits = SE->getUnsignedRange(IV).getActiveBits();
+    MaskBits = (int)SE->getUnsignedRange(IV).getActiveBits();
   int DestNumSigBits = UseInst->getType()->getFPMantissaWidth();
   if (MaskBits <= DestNumSigBits) {
     for (User *U : UseInst->users()) {


        


More information about the llvm-commits mailing list