[PATCH] D122836: Fold more memchr calls
Martin Sebor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 10:28:48 PDT 2022
msebor created this revision.
msebor added reviewers: bkramer, xbolva00, nikic.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
msebor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch extends the `LibCallSimplifier::optimizeMemChr` folder to perform two more simplifications:
1. folding the case where the size is equal to 1 to a byte comparison, analogously to other such cases already handled by other folders
2. simplifying to a size comparison the case where the sought character with constant value is known either to appear in the constant array or not to appear, regardless of the size argument
I have tested the patch by bootstrapping LLVM + Clang on x86_64-linux and running `check-all`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122836
Files:
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/memchr-2.ll
llvm/test/Transforms/InstCombine/memchr-3.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122836.419508.patch
Type: text/x-patch
Size: 9730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220331/00e448d0/attachment.bin>
More information about the llvm-commits
mailing list