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

Martin Sebor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 16:20:15 PDT 2022


msebor 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]]
 ;
----------------
nikic wrote:
> 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?
Yes, I screwed up the merge.  I'm not used to working this way.  I'm spending more time moving code around than actually developing it, and making mistakes in the process.


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

https://reviews.llvm.org/D123816



More information about the llvm-commits mailing list