-
Notifications
You must be signed in to change notification settings - Fork 11.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
[clang-cl] implement support for [[msvc::intrinsic]] #59511
Comments
@llvm/issue-subscribers-clang-frontend |
https://learn.microsoft.com/en-us/cpp/cpp/attributes?view=msvc-170#msvcintrinsic says
So the number of possible useful functions is very small. Clang 15 -O0 codegen is good as well.
Use |
I guess a generic attribute is still better than hard coding, as the number is not so that small (see microsoft/STL#3548). |
Actually it mangles std::move behaviour.
Instead of binding an rvalue to a forwarding reference and then casting it to rvalue reference, only a binding of rvalue to rvalue reference occurs here. The output is:
It might be an intentional side-effect of attribute to "hack" around this limitation albeit documentation doesn't notify about it. Declaring |
@Swiftkill Hi, I've reported the bug to Visual Studio Developer Community with your example and slight modifications. |
I have a PR up that went with a different approach. #76596. I know this doesn't exactly map to the I went this route instead of an intrinsic cast attribute so that move and other std specific warnings still work with custom STL implementations. We may be able to extend it in the future as C++ continues to require the compiler to poke into the We have also noticed this non-standard behaviour with We also don't have worry about all the edge cases with just replacing the function call with In the future if we do add some intrinsic cast or go down the same reasoning as msvc, "The reason the compiler decided to go down the attribute route is that we want to eventually extend the scenarios it can cover", ideally it would also work with all small functions like |
See https://devblogs.microsoft.com/cppblog/improving-the-state-of-debug-performance-in-c/
"""
The new attribute will semantically replace a function call with a cast to that function’s return type if the function definition is decorated with [[msvc::intrinsic]]. You can see how we applied this new attribute in the STL: GH3182. The reason the compiler decided to go down the attribute route is that we want to eventually extend the scenarios it can cover and offer a data-driven approach to selectively decorate code with the new functionality. The latter is important for users of MSVC as well.
"""
The text was updated successfully, but these errors were encountered: