[PATCH] D123472: [SimplifyLibCalls] avoid slicing 64-bit integers in an ILP32 build (PR #54739)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 11 12:19:08 PDT 2022
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:207
+static StringRef substr(StringRef Str, uint64_t Len) {
+ // Avoid truncating the length if size_t is 32-bits.
+ return Len >= Str.size() ? Str : Str.substr(0, Len);
----------------
This comment is redundant with the function comment now.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:463
+ StringRef::size_type MinLen1 = std::min((uint64_t)Str1.size(), Length);
+ StringRef::size_type MinLen2 = std::min((uint64_t)Str2.size(), Length);
+ StringRef SubStr1 = substr(Str1, MinLen1);
----------------
We shouldn't need both the std::min and the helper function.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123472/new/
https://reviews.llvm.org/D123472
More information about the llvm-commits
mailing list