[PATCH] D123819: [InstCombine] Fold strlen and strnlen recursively.
Martin Sebor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 14 13:29:00 PDT 2022
msebor created this revision.
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.
This patch in the `strnlen` series introduces a recursive function, `LibCallSimplifier::minStringLength()`, to handle calls with pointer arguments involving nested conditional expressions. This also enhances the folding of `strlen`. For `strnlen`, only constant bounds are handled.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123819
Files:
llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/strlen-1.ll
llvm/test/Transforms/InstCombine/strlen-4.ll
llvm/test/Transforms/InstCombine/strnlen-2.ll
llvm/test/Transforms/InstCombine/strnlen-3.ll
llvm/test/Transforms/InstCombine/strnlen-4.ll
llvm/test/Transforms/InstCombine/strnlen-5.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123819.422950.patch
Type: text/x-patch
Size: 27227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220414/597a60f4/attachment-0001.bin>
More information about the llvm-commits
mailing list