[PATCH] D73000: [InstCombine] Optimize strchr(cststr, C)
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 21 09:48:47 PST 2020
hans added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:948
// target.
- // FIXME: On a 64 bit architecture this prevents us from using the
- // interesting range of alpha ascii chars. We could do better by emitting
- // two bitfields or shifting the range by 64 if no lower chars are used.
- if (!DL.fitsInLegalInteger(Max + 1))
- return nullptr;
+ if (!DL.fitsInLegalInteger(Max + 1)) {
+ // Build chain of OR comparisons
----------------
xbolva00 wrote:
> joerg wrote:
> > The switch table logic is fine with lowering it to a multiple tests, isn't it?
> Hmm.. building switch directly is for some cases* better choice** than ORs, but I am wondering if this is best solution here - Maybe @hans could give us some recommendations here?
>
> * https://godbolt.org/z/BuR6St (switch is faster than ors).
> ** Ideally, we should turn chain of ORs to switch too.
>
> Ideas?
>
>
I think we (SimplifyCFG) does turn a chain of ORs into a switch, but only logical or, not bitwise. Maybe emitting a chain of logical or would be good here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73000/new/
https://reviews.llvm.org/D73000
More information about the llvm-commits
mailing list