This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Move AttributeMask to a separate header
ClosedPublic

Authored by IncludeGuardian on Jun 25 2023, 2:30 PM.

Details

Summary

Move AttributeMask out of llvm/IR/Attributes.h to a new file
llvm/IR/AttributeMask.h. After doing this we can remove the
#include <bitset> and #include <set> directives from Attributes.h.
Since there are many headers including Attributes.h, but not needing
the definition of AttributeMask, this causes unnecessary bloating of
the translation units and slows down compilation.

Additionally, the llvm/ADT/SmallString.h include directive was not
needed and has been removed.

This commit adds the include directive for llvm/IR/AttributeMask.h
to the handful of source files that need to see the definition.

This reduces the total number of preprocessing tokens across the LLVM
source files in lib from (roughly) 1,917,509,187 to 1,902,982,273 - a
reduction of ~0.76%. This should result in a small improvement in
compilation time.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJun 25 2023, 2:30 PM
IncludeGuardian requested review of this revision.Jun 25 2023, 2:30 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 25 2023, 2:30 PM

This was found with IncludeGuardian 0.0.8 and the recommendation was given here https://gist.github.com/IncludeGuardian/4132d5149576a55e0560fae6f8ff4a38#file-before-yaml-L4053-L4055

The estimates of token count were run before and after this commit and can be seen here before.yaml (1,917,509,187) and after.yaml (1,902,982,273).

nikic accepted this revision.Jun 26 2023, 1:06 PM

LGTM

This revision is now accepted and ready to land.Jun 26 2023, 1:06 PM
This revision was automatically updated to reflect the committed changes.