[PATCH] D123816: [InstCombine] Fold strnlen with a bound of zero and one.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 13:51:34 PDT 2022


nikic added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/strnlen-2.ll:92
+; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[C:%.*]], i64 3, i64 5
+; CHECK-NEXT:    ret i64 [[TMP1]]
 ;
----------------
msebor wrote:
> nikic wrote:
> > Hm, how does this one get folded? It doesn't have either 0 or 1 as the bound.
> This is `strnlen(C ? "123" : "12345", 6)`.  (I use `sN` for a constant string of length `N` and `aN` for a non-const array of `N` elements.)
I still don't see how this one would get folded as part of this patch. Are you sure it's not from one of the later patches?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123816/new/

https://reviews.llvm.org/D123816



More information about the llvm-commits mailing list