[PATCH] D127766: [InstCombine] Fold memcmp of constant arrays and variable size
Martin Sebor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 15 15:43:06 PDT 2022
msebor added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:1170
+ Value *Cmp = B.CreateICmp(ICmpInst::ICMP_ULE, Size, MaxSize);
+ int IRes = LStr[Pos] < RStr[Pos] ? -1 : 1;
+ Value *Res = ConstantInt::get(CI->getType(), IRes);
----------------
Whoops, the comparison is required to be done in `unsigned char`. Let me fix that.
I also spoke too soon about the loop The suggested form seems to have made the `strncmp` handling quite a bit more cumbersome than the original.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127766/new/
https://reviews.llvm.org/D127766
More information about the llvm-commits
mailing list