[PATCH] D154725: [SimplifyLibCalls] Fold strcmp for short string literals
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 7 16:23:52 PDT 2023
efriedma added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:612
if (!HasStr1 && HasStr2) {
if (canTransformToMemCmp(CI, Str1P, Len2, DL))
return copyFlags(
----------------
nikic wrote:
> This is the transform that implements what you're trying to do, but taking dereferenceability into account.
https://github.com/llvm/llvm-project/issues/58003 is requesting that we generate control flow for small strings. For example, transforming `strcmp(c, "x") == 0` to `c[0] == 'x' && c[1] == '\0'`. This is distinct from transforming it to a memcmp. (Of course, the current version of this patch doesn't implement that.)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154725/new/
https://reviews.llvm.org/D154725
More information about the llvm-commits
mailing list