This speeds up preprocessing, specifically for preprocessing the clang sources time is reduced by about -36%,
using measurements on M1Pro with a release+thinLTO build.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Lex/PPDirectives.cpp | ||
---|---|---|
520 | Storing this pointer is only safe as long as SkipExcludedConditionalBlock can never be called recursively, since any modification to the DenseMap can invalidate this pointer. Is there some cheap way to assert that? If not, maybe we should do the lookup again in endLexPass, which would always be correct. |
clang/lib/Lex/PPDirectives.cpp | ||
---|---|---|
520 | Good point! I can add a bool to assert that SkipExcludedConditionalBlock is not recursively called. |
clang/lib/Lex/PPDirectives.cpp | ||
---|---|---|
520 | Done 👍 |
Couple more minor things, but basically LGTM.
clang/include/clang/Lex/Preprocessor.h | ||
---|---|---|
2601 | Would be good to mention *why* this is unsafe so we don't remove it by accident (or so we *can* remove it later if we ever change the code so it doesn't matter anymore). Oh, and style nit: we should move these new fields to the top of the class where all the other fields are. |
Add more comments about the use of SkippingExcludedConditionalBlock and move the new Preprocessor fields towards the top of the class.
Do you believe an entry in the ReleaseNotes would get this achievement more visibility?
I second that this would be worthy of a release note. Seems like quite a big improvement.
I wonder how much is the total speedup for a full LLVM build or such?
Would be good to mention *why* this is unsafe so we don't remove it by accident (or so we *can* remove it later if we ever change the code so it doesn't matter anymore).
Oh, and style nit: we should move these new fields to the top of the class where all the other fields are.