-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot constant fold functions from <cwchar> #100929
Comments
Given how much code on Windows uses |
From a quick look, the only wchar_t function which is optimized right now is wcslen: llvm-project/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp Lines 1072 to 1080 in beb12f9
|
@s-barannikov It occurs to me that this may also be a good way to phase in support for non-8-bit bytes in SLC. If we support wchar functions, which take 16 or 32 bit characters, then supporting 16/32-bit |
The main issue with constant folding To support folding
Supporting |
Clang has builtins for a lot of the
<cwchar>
functions and can constant evaluate them when using the__builtin_
variants, but the backend can't constant fold them. There doesn't seem to be much of a technical reason, since their<cstring>
counterparts can often be constant folded, and some even have passes dedicated to them.For example,
compiles just fine, but
test
generates horrible code compared to what should be possible: https://godbolt.org/z/xP3vM9jPnThe text was updated successfully, but these errors were encountered: