[PATCH] D130922: [InstCombine] Add support for stpncpy folding

Martin Sebor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 10:35:41 PDT 2022


msebor added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:746
+
+  --SrcLen; // Unbias length or set it to UINT64_MAX if unknown.
 
----------------
efriedma wrote:
> It's confusing to reason about what happens here if SrcLen == UINT64_MAX.  Is there a reason you got rid of the early return?
I suspect I forgot that `GetStringLength` returns nonzero even for constants that aren't nul-terminated strings, including past-the-end pointers (besides also not actually returning their length).  I find //that// confusing.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130922/new/

https://reviews.llvm.org/D130922



More information about the llvm-commits mailing list