[PATCH] D123631: [InstCombine] Fold memrchr calls with sequences of identical bytes.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 14 05:55:53 PDT 2022
nikic added a comment.
Just wondering if there's any specific motivation for this pattern, as it seems oddly specific. Is this something that GCC implements?
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:933
+ // C and N, fold memrchr(S, C, N) to
+ // N != 0 && N <= sizeof S && *S == C ? S + N - 1 : null
+ // AKA
----------------
Why do we need the `N <= sizeof S` comparison here? As that would be UB, I think we can omit it here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123631/new/
https://reviews.llvm.org/D123631
More information about the llvm-commits
mailing list