aboutsummaryrefslogtreecommitdiff
path: root/lldb/unittests/Target/ModuleCacheTest.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2022-07-15 10:26:19 -0700
committerBen Langmuir <blangmuir@apple.com>2022-07-28 12:24:06 -0700
commit02871701400253a49de502a5fef770f92772f6bc (patch)
tree11659bad3fd9d68ab691e696ea91c02b7301fb15 /lldb/unittests/Target/ModuleCacheTest.cpp
parent66eabeb65dc9dc53fa791e444fa228a406bd304e (diff)
downloadllvm-02871701400253a49de502a5fef770f92772f6bc.zip
llvm-02871701400253a49de502a5fef770f92772f6bc.tar.gz
llvm-02871701400253a49de502a5fef770f92772f6bc.tar.bz2
[clang][deps] Include canonical invocation in ContextHash
The "strict context hash" is insufficient to identify module dependencies during scanning, leading to different module build commands being produced for a single module, and non-deterministically choosing between them. This commit switches to hashing the canonicalized `CompilerInvocation` of the module. By hashing the invocation we are converting these from correctness issues to performance issues, and we can then incrementally improve our ability to canonicalize command-lines. This change can cause a regression in the number of modules needed. Of the 4 projects I tested, 3 had no regression, but 1, which was clang+llvm itself, had a 66% regression in number of modules (4% regression in total invocations). This is almost entirely due to differences between -W options across targets. Of this, 25% of the additional modules are system modules, which we could avoid if we canonicalized -W options when -Wsystem-headers is not present -- unfortunately this is non-trivial due to some warnings being enabled in system headers by default. The rest of the additional modules are mostly real differences in potential warnings, reflecting incorrect behaviour in the current scanner. There were also a couple of differences due to `-DFOO` `-fmodule-ignore-macro=FOO`, which I fixed here. Since the output paths for the module depend on its context hash, we hash the invocation before filling in outputs, and rely on the build system to always return the same output paths for a given module. Note: since the scanner itself uses an implicit modules build, there can still be non-determinism, but it will now present as different module+hashes rather than different command-lines for the same module+hash. Differential Revision: https://reviews.llvm.org/D129884
Diffstat (limited to 'lldb/unittests/Target/ModuleCacheTest.cpp')
0 files changed, 0 insertions, 0 deletions