diff options
author | Volodymyr Sapsai <vsapsai@apple.com> | 2019-08-28 23:31:32 +0000 |
---|---|---|
committer | Volodymyr Sapsai <vsapsai@apple.com> | 2019-08-28 23:31:32 +0000 |
commit | f91b6f8159b101688eef87c75179209699c0d405 (patch) | |
tree | 4b25bee1271276233e8403bea83ff2c7e8611457 /clang/lib/Serialization/ModuleManager.cpp | |
parent | 660efa596f6b2ffba96e25dd728e84b2947115b9 (diff) | |
download | llvm-f91b6f8159b101688eef87c75179209699c0d405.zip llvm-f91b6f8159b101688eef87c75179209699c0d405.tar.gz llvm-f91b6f8159b101688eef87c75179209699c0d405.tar.bz2 |
[Modules] Fix rebuilding an updated module for each of its consumers.
Marking a module for a rebuild when its signature differs from the
expected one causes redundant module rebuilds for incremental builds.
When a module is updated, its signature changes. But its consumers still
have the old signature and loading them will result in signature
mismatches. It will correctly cause the rebuilds for the consumers but
we don't need to rebuild the common module for each of them as it is
already up to date.
In practice this bug causes longer build times. We are doing more work
than required and only a single process can build a module, so parallel
builds degrade to a single-process mode where extra processes are just
waiting on a file lock.
Fix by not marking a module dependency for a rebuild on signature
mismatch. We'll check if it is up to date when we load it.
rdar://problem/50212358
Reviewers: dexonsmith, bruno, rsmith
Reviewed By: dexonsmith, bruno
Subscribers: jkorous, ributzka, cfe-commits, aprantl
Differential Revision: https://reviews.llvm.org/D66907
llvm-svn: 370274
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 8b51a42..878ee46 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -204,13 +204,8 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, // Read the signature eagerly now so that we can check it. Avoid calling // ReadSignature unless there's something to check though. if (ExpectedSignature && checkSignature(ReadSignature(NewModule->Data), - ExpectedSignature, ErrorStr)) { - // Try to remove the buffer. If it can't be removed, then it was already - // validated by this process. - if (!getModuleCache().tryToDropPCM(NewModule->FileName)) - FileMgr.invalidateCache(NewModule->File); + ExpectedSignature, ErrorStr)) return OutOfDate; - } // We're keeping this module. Store it everywhere. Module = Modules[Entry] = NewModule.get(); |