[PATCH] D122836: [SimplifyLibCalls] Fold more memchr calls

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 03:56:20 PDT 2022


xbolva00 added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:924
+
+    if (MaxLen == UINT64_MAX) {
+      // Fold memchr(s, c, n) -> n < Pos ? null : s + Pos
----------------
!LenC ?


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:942
+    MaxLen = Pos < MaxLen ? Pos + 1 : Pos;
+  } else if (MaxLen == UINT64_MAX)
+    // From now on we need at least constant length and constant array.
----------------
If possible better to check for LenC than comparing with UINT64_MAX.. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122836



More information about the llvm-commits mailing list