aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-10-16 09:55:02 +0200
committerGitHub <noreply@github.com>2023-10-16 09:55:02 +0200
commit2371d0ab263c164be820f961095cc22076566d12 (patch)
treea21e440d054aa09aaaa4de7235c32524edccf282 /llvm/lib/Bitcode/Reader/MetadataLoader.cpp
parent5c0931727eb045c2ed2828d070eb16d4ac87b933 (diff)
downloadllvm-2371d0ab263c164be820f961095cc22076566d12.zip
llvm-2371d0ab263c164be820f961095cc22076566d12.tar.gz
llvm-2371d0ab263c164be820f961095cc22076566d12.tar.bz2
[DebugInfo] Only call upgradeCULocals() at module level (#68965)
Loading a 2GB bitcode file, I noticed that we spend minutes just running upgradeCULocals(). Apparently it gets invoked every time a metadata block is loaded, which will be once at the module level and then once per function. However, the relevant metadata only exists at the module level, so running this upgrade per function is unnecessary.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/MetadataLoader.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 1e9ed5f..4aaaea7 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -705,10 +705,11 @@ class MetadataLoader::MetadataLoaderImpl {
return Error::success();
}
- void upgradeDebugInfo() {
+ void upgradeDebugInfo(bool ModuleLevel) {
upgradeCUSubprograms();
upgradeCUVariables();
- upgradeCULocals();
+ if (ModuleLevel)
+ upgradeCULocals();
}
void callMDTypeCallback(Metadata **Val, unsigned TypeID);
@@ -1085,7 +1086,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseMetadata(bool ModuleLevel) {
// Reading the named metadata created forward references and/or
// placeholders, that we flush here.
resolveForwardRefsAndPlaceholders(Placeholders);
- upgradeDebugInfo();
+ upgradeDebugInfo(ModuleLevel);
// Return at the beginning of the block, since it is easy to skip it
// entirely from there.
Stream.ReadBlockEnd(); // Pop the abbrev block context.
@@ -1116,7 +1117,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseMetadata(bool ModuleLevel) {
return error("Malformed block");
case BitstreamEntry::EndBlock:
resolveForwardRefsAndPlaceholders(Placeholders);
- upgradeDebugInfo();
+ upgradeDebugInfo(ModuleLevel);
return Error::success();
case BitstreamEntry::Record:
// The interesting case.