[llvm] a7a1be1 - [InstCombine] convert second std::min argument to same type as first

Martin Sebor via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 16:35:48 PDT 2022


Author: Martin Sebor
Date: 2022-08-16T17:34:33-06:00
New Revision: a7a1be11e69d83d6bc15ff5909dd1f1bff3fed7c

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

LOG: [InstCombine] convert second std::min argument to same type as first

Ensure both arguments to std::min have the same type in all data models.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index 94ce41ac1936..232ec6f586ac 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -740,7 +740,7 @@ Value *LibCallSimplifier::optimizeStrLCpy(CallInst *CI, IRBuilderBase &B) {
   else {
     // Set the length of the source for the function to return to its
     // size, and cap NBytes at the same.
-    SrcLen = std::min(SrcLen, Str.size());
+    SrcLen = std::min(SrcLen, uint64_t(Str.size()));
     NBytes = std::min(NBytes - 1, SrcLen);
   }
 


        


More information about the llvm-commits mailing list