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

Henry Jiang via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 09:46:51 PDT 2026


================
@@ -1443,6 +1443,10 @@ unsigned TargetLibraryInfoImpl::getWCharSize(const Module &M) const {
   if (auto *ShortWChar = cast_or_null<ConstantAsMetadata>(
       M.getModuleFlag("wchar_size")))
     return cast<ConstantInt>(ShortWChar->getValue())->getZExtValue();
+  return getDefaultWCharSize(M);
----------------
mustartt wrote:

Do we need a new `getDefaultWCharSize` on the `TLI` as that information is already available through the target triple?

I think a better name might be `getTargetDefaultWCharSize` to leave less confusion.

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


More information about the llvm-commits mailing list