This patch extends the LibCallSimplifier::optimizeMemChr folder to perform two more simplifications:
- folding the case where the size is equal to 1 to a byte comparison, analogously to other such cases already handled by other folders
- 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.
I think MaxLen has lost most of it's purpose now, and you can just do a LenC->isOne() check in the preceding branch?