-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<array>: Reduce template instantiation in the deduction guide for array
#5666
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
Conversation
734f765 to
2bd07f5
Compare
Temporarily disable the new approach for Clang + 32-bit platform.
2bd07f5 to
d41da52
Compare
|
Thanks for looking into this. Because this is afflicted by unknown Clang flakiness, and I am beyond overloaded, I'm going to close it without merging, instead of moving it back to WIP for a while. You're welcome to resubmit if you can get to the bottom of what's going on with Clang. |
|
I'd like to revive this after merging #5704. |
|
I'm still not terribly enthusiastic about increasing the effective limit from 49K to 64K, but we did figure out what was happening with the flakiness and cured it (even if we don't understand the root cause in lld-link.exe on x86). If you want to resurrect this, I'll review it. Thanks @AlexGuteniev for reminding me about this PR that I immediately forgot about. |
I'm still seeing the changes as more throughput-related. I roughly remember that when performing successful CTAD from more than 10K arguments, the compilation became significantly faster with the new approach. |
When the numbers of template parameters are large enough, either recursive instantiation or fold expression are rejected, see also LLVM-132021. So we need some other approach to achieve CTAD for a long
std::array.This PR eliminates recursive template instantiation in the deduction guide for
arrayby using a single non-templateconstexprfunction to calculate the result. Shortcut instantiation doesn't seem very useful as instantiation ofis_same_vis quite cheap.For MSVC and Clang, if the number of template arguments in the deduction guide is larger than 65535, the compilers will crash. This is tracked in LLVM-119600 and DevCom-10946374. As a result, CTAD for longer
arrays is not supported yet.Fixes #5665.