[llvm] [LoopIdiom] Don't introduce `wcslen` calls when `wchar` size is not the default (PR #213629)

Ömer Sinan Ağacan via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 03:58:33 PDT 2026


osa1 wrote:

@efriedma-quic

> If we're going to do this, it should be in TargetLibraryInfo: we should set wcslen to unavailable. (loopidiom queries TargetLibraryInfo so it won't generate a call to an unavailable function.)

This would change more than what I intended here, for example it would disable `SimplifyLibCalls` of explicit (rather than compiler-introduced) `wcslen` calls.

Do we have a reason to not optimize explicit `wcslen` calls with `-fshort-wchar`?

---

@sevaa I think that would help with explicit `wcslen` calls but not with compiler-introduces `wcslen` calls. So I think your suggestion is in scope for #195149 rather than this one.

https://github.com/llvm/llvm-project/pull/213629


More information about the llvm-commits mailing list