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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 13:32:30 PDT 2022


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:900
+
+  if (MaxLen == 1) {
+    // Fold memchr(x, y, 1) --> *x == y ? x : null for any x and y,
----------------
I think MaxLen has lost most of it's purpose now, and you can just do a `LenC->isOne()` check in the preceding branch?


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

https://reviews.llvm.org/D122836



More information about the llvm-commits mailing list