[PATCH] D127766: [InstCombine] Fold memcmp of constant arrays and variable size
Martin Sebor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 14 10:23:04 PDT 2022
msebor created this revision.
msebor added reviewers: courbet, nikic, xbolva00, beanz, spatel.
Herald added a subscriber: hiraditya.
Herald added a project: All.
msebor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The `memcmp` simplifier is limited to folding to constants calls with constant arrays and constant sizes. This change adds the ability to simplify `memcmp(A, B, N)` calls with constant `A` and `B` and variable `N` to the pseudocode equivalent of
N <= Pos ? 0 : (A < B ? -1 : B < A ? +1 : 0)
where `Pos` is the offset of the first mismatch between `A` and `B`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D127766
Files:
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/memcmp-5.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127766.436840.patch
Type: text/x-patch
Size: 13234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220614/0302b031/attachment.bin>
More information about the llvm-commits
mailing list