diff options
author | Nikola Tesic <nikola.tesic@syrmia.com> | 2022-04-21 13:56:51 +0200 |
---|---|---|
committer | Djordje Todorovic <djordje.todorovic@syrmia.com> | 2022-04-21 13:58:17 +0200 |
commit | c5600aef888b9c32c578edc9c807d61d72a37c08 (patch) | |
tree | 25b970c0222c59bda28802fd30cb9d604a695f9f /llvm/lib/Transforms/Utils/Debugify.cpp | |
parent | a41aaf166fed03e18021885d0951f1dec63b25b9 (diff) | |
download | llvm-c5600aef888b9c32c578edc9c807d61d72a37c08.zip llvm-c5600aef888b9c32c578edc9c807d61d72a37c08.tar.gz llvm-c5600aef888b9c32c578edc9c807d61d72a37c08.tar.bz2 |
[Debugify] Limit number of processed functions for original mode
Debugify in OriginalDebugInfo mode, does (DebugInfo) collect-before-pass & check-after-pass
for each instruction, which is pretty expensive. When used to analyze DebugInfo losses
in large projects (like LLVM), this raises the build time unacceptably.
This patch introduces a limit for the number of processed functions per compile unit.
By default, the limit is set to UINT_MAX (practically unlimited), and by using the introduced
option -debugify-func-limit the limit could be set to any positive integer number.
Differential revision: https://reviews.llvm.org/D115714
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Debugify.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp index 7448e3e..205f7a7 100644 --- a/llvm/lib/Transforms/Utils/Debugify.cpp +++ b/llvm/lib/Transforms/Utils/Debugify.cpp @@ -37,6 +37,11 @@ namespace { cl::opt<bool> Quiet("debugify-quiet", cl::desc("Suppress verbose debugify output")); +cl::opt<uint64_t> DebugifyFunctionsLimit( + "debugify-func-limit", + cl::desc("Set max number of processed functions per pass."), + cl::init(UINT_MAX)); + enum class Level { Locations, LocationsAndVariables @@ -292,6 +297,7 @@ bool llvm::collectDebugInfoMetadata(Module &M, return false; } + uint64_t FunctionsCnt = DebugInfoBeforePass.DIFunctions.size(); // Visit each instruction. for (Function &F : Functions) { // Use DI collected after previous Pass (when -debugify-each is used). @@ -301,6 +307,9 @@ bool llvm::collectDebugInfoMetadata(Module &M, if (isFunctionSkipped(F)) continue; + // Stop collecting DI if the Functions number reached the limit. + if (++FunctionsCnt >= DebugifyFunctionsLimit) + break; // Collect the DISubprogram. auto *SP = F.getSubprogram(); DebugInfoBeforePass.DIFunctions.insert({&F, SP}); @@ -535,6 +544,9 @@ bool llvm::checkDebugInfoMetadata(Module &M, if (isFunctionSkipped(F)) continue; + // Don't process functions without DI collected before the Pass. + if (!DebugInfoBeforePass.DIFunctions.count(&F)) + continue; // TODO: Collect metadata other than DISubprograms. // Collect the DISubprogram. auto *SP = F.getSubprogram(); |