Disable /analyze
for libcxx
#5724
Merged
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.
While working on a compiler improvement that slightly increases compiler memory consumption, Jennifer Yao encountered a libcxx failure due to the x86-hosted compiler running out of memory. What was happening is that our use of
/analyze
in the libcxx test suite was causing a ranges test to consume a wild 3.34 GB, so any slight increase would push it over the edge.To be a good kitty, I reported this as VSO-2576569 "
/analyze
consumes 13.9x more memory for a ranges algorithm test". And of course, x86-hosted tools in the year 2025 are an abomination, and it's bad and wrong that we're still shipping them. But as long as we do, we need to exercise them. (And also, switching over our internal test harness to use x64-hosted x86-targeting tools would be moderately obnoxious.)Instead of skipping the affected test, or scouting for similarly memory-hungry tests, I rethought why we're using
/analyze
in libcxx in the first place. We pioneered aggressively using/analyze
in the STL's test suites, and its usage intests/std
provides extremely valuable coverage. We run far fewer libcxx configurations (as libcxx has a ton of tests, every compiler configuration is very expensive), so we figured that we may as well add/analyze
while we were at it. However, in addition to increasing test runtime (and compiler memory consumption!), this regularly causes headaches because libcxx developers naturally don't audit their tests with MSVC, much less MSVC/analyze
, so we have to deal with warnings emitted by test code. And while this coverage has found a moderate number of compiler bugs in/analyze
itself, it generally hasn't found unique problems in the STL which weren't found bytests/std
already.Finally, in the last year or two, MS has gotten significantly more serious about increasing
/analyze
adoption internally, with all of MSVC now routinely being built with/analyze
. This means that the STL is being exercised far more widely with static analysis, and by realistic usage instead of the unusual patterns of a Standard Library test suite, so running it in the libcxx test suite is less important than it used to be.This PR removes
/analyze
from libcxx and restores all of the tests we had knownfailed. On my 5950X, this results in a nice speedup, from 1590s (26m 30s) to 892s (14m 52s), a 1.78x speedup.