Skip to content

Commit bae9f04

Browse files
committed
[Reproducer] Disable parallel module import in SwiftASTContext during replay.
The Swift AST context can imports all modules in parallel. While this leads to a great performance improvement, it introduces a level of non-determinism during replay. We should disable this functionality during replay. Although it's still possible that this hides a bug, it means that at least replays will be deterministic. rdar://56947303
1 parent d6bbf63 commit bae9f04

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lldb/source/Symbol/SwiftASTContext.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,10 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance(lldb::LanguageType language,
19481948
// the Clang modules that were imported in this module. This can
19491949
// be a lot of work (potentially ten seconds per module), but it
19501950
// can be performed in parallel.
1951-
llvm::ThreadPool pool;
1951+
const unsigned threads = repro::Reproducer::Instance().IsReplaying()
1952+
? 1
1953+
: llvm::hardware_concurrency();
1954+
llvm::ThreadPool pool(threads);
19521955
for (size_t mi = 0; mi != num_images; ++mi) {
19531956
auto module_sp = target.GetImages().GetModuleAtIndex(mi);
19541957
pool.async([=] {

0 commit comments

Comments
 (0)