[PATCH] D129224: [InstCombine] Fold strtoul and strtoull and avoid PR #56293

Martin Sebor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 08:32:17 PDT 2022


msebor updated this revision to Diff 442932.
msebor marked an inline comment as done.
msebor added a comment.

Revision 2 of the patch addressing reviewer suggestions:

- Use a conditional instead of conversion from `bool`.
- Avoid assuming `atoi` etc. argument is a nul-terminated string.
- Use `llvm::isDigit` et al. instead of the C standard functions.
- Use `SaturatingMultiplyAdd` to detect overflow.
- Update `getConstantStringInfo` to make it clear it need not return a nul-terminated string.
- Add tests.


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

https://reviews.llvm.org/D129224

Files:
  llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/test/Transforms/InstCombine/str-int-2.ll
  llvm/test/Transforms/InstCombine/str-int-4.ll
  llvm/test/Transforms/InstCombine/str-int-5.ll
  llvm/test/Transforms/InstCombine/str-int.ll
  llvm/test/Transforms/InstCombine/strcall-no-nul.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129224.442932.patch
Type: text/x-patch
Size: 43968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220707/975148b3/attachment.bin>


More information about the llvm-commits mailing list