Skip to content

Commit 0ca8458

Browse files
[NFC] Remove caching for "isOverlay" computation when emitting a trace.
Based on measurements, it seemed to save about 0.2 ms - 0.4 ms for a module with a large number of imports from the SDK. That's insignificant compared to the compile time for a typical module, which usually takes somewhere between a few seconds and a few minutes.
1 parent 99cefe7 commit 0ca8458

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,6 @@ class ABIDependencyEvaluator {
328328

329329
llvm::DenseSet<ModuleDecl *> visited;
330330

331-
/// Cache to avoid recomputing public imports of Swift modules repeatedly.
332-
llvm::DenseMap<ModuleDecl *, bool> isOverlayCache;
333-
334331
/// Helper function to handle invariant violations as crashes in debug mode.
335332
void crashOnInvariantViolation(
336333
llvm::function_ref<void (llvm::raw_string_ostream &)> f) const;
@@ -484,18 +481,13 @@ void ABIDependencyEvaluator::reexposeImportedABI(
484481
bool ABIDependencyEvaluator::isOverlayOfClangModule(ModuleDecl *swiftModule) {
485482
assert(!swiftModule->isNonSwiftModule());
486483

487-
auto cacheEntry = isOverlayCache.find(swiftModule);
488-
if (cacheEntry != isOverlayCache.end())
489-
return cacheEntry->second;
490-
491484
llvm::SmallPtrSet<ModuleDecl *, 8> importList;
492485
::getImmediateImports(swiftModule, importList,
493486
{ModuleDecl::ImportFilterKind::Public});
494487
bool isOverlay =
495488
llvm::any_of(importList, [&](ModuleDecl *importedModule) -> bool {
496489
return isClangOverlayOf(swiftModule, importedModule);
497490
});
498-
isOverlayCache[swiftModule] = isOverlay;
499491
return isOverlay;
500492
}
501493

0 commit comments

Comments
 (0)