Win8 baseline: Improve STL Hardening codegen size#5433
Merged
StephanTLavavej merged 2 commits intomicrosoft:mainfrom Apr 29, 2025
Merged
Win8 baseline: Improve STL Hardening codegen size#5433StephanTLavavej merged 2 commits intomicrosoft:mainfrom
StephanTLavavej merged 2 commits intomicrosoft:mainfrom
Conversation
…tin_verbose_trap`. + MSVC [`__fastfail`](https://learn.microsoft.com/en-us/cpp/intrinsics/fastfail?view=msvc-170): "Support for the native fast fail mechanism began in Windows 8." + Clang [`__builtin_verbose_trap`](https://clang.llvm.org/docs/LanguageExtensions.html#builtin-verbose-trap) + I measured `v[idx]` on x64 with `/O2`, and this reduced codegen size from 56 bytes to 29 bytes. Clang codegen was similarly improved. + In `<ranges>`, we need to avoid a Clang error: argument to `__builtin_verbose_trap` must be a pointer to a constant string
Member
Author
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Member
Author
|
I pushed a commit to work around |
zacklj89
approved these changes
Apr 29, 2025
9 tasks
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗺️ Overview
__fastfail:<intrin.h>. We generally try to avoid duplicating intrinsic declarations (due to calling convention madness) but in this one case I think it's fine. Because<yvals.h>is very central and special, moving the declaration into<intrin0.h>might still be overly impactful.FAST_FAIL_INVALID_ARGbecause there's no way we can drag in<winnt.h>.__builtin_verbose_trap:v[idx]on x64 with/O2:_invoke_watson()function call.<ranges>, we need to avoid a Clang error: "argument to__builtin_verbose_trapmust be a pointer to a constant string"./clr /std:c++20silent bad codegen with the__fastfailintrinsic".📜 Changelog
__fastfailintrinsic that was added in Windows 8, and the Clang__builtin_verbose_trapintrinsic.