aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Basic/SourceManagerTest.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2023-10-06 23:52:19 +0200
committerGitHub <noreply@github.com>2023-10-06 14:52:19 -0700
commit537344fc502474545d332bf5592db257cc568250 (patch)
tree682c5ad7a1dc993f3857d32646ab4405c3a99a85 /clang/unittests/Basic/SourceManagerTest.cpp
parent8eff5e4b696d2b70e46bcea7a81288a823906f20 (diff)
downloadllvm-537344fc502474545d332bf5592db257cc568250.zip
llvm-537344fc502474545d332bf5592db257cc568250.tar.gz
llvm-537344fc502474545d332bf5592db257cc568250.tar.bz2
[clang][modules] Move `SLocEntry` search into `ASTReader` (#66966)
In `SourceManager::getFileID()`, Clang performs binary search over its buffer of `SLocEntries`. For modules, this binary search fully deserializes the entire `SLocEntry` block for each visited entry. For some entries, that includes decompressing the associated buffer (e.g. the predefines buffer, macro expansion buffers, contents of volatile files), which shows up in profiles of the dependency scanner. This patch moves the binary search over loaded entries into `ASTReader`, which can perform cheaper partial deserialization during the binary search, reducing the wall time of dependency scans by ~3%. This also reduces the number of retired instructions by ~1.4% on regular (implicit) modules compilation. Note that this patch drops the optimizations based on the last lookup ID (pruning the search space and performing linear search before resorting to the full binary search). Instead, it reduces the search space by asking `ASTReader::GlobalSLocOffsetMap` for the containing `ModuleFile` and only does binary search over entries of single module file.
Diffstat (limited to 'clang/unittests/Basic/SourceManagerTest.cpp')
0 files changed, 0 insertions, 0 deletions