[PATCH] D115714: [Debugify] Limit number of processed functions for original mode
Nikola Tesic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 28 04:52:50 PDT 2022
ntesic updated this revision to Diff 418545.
ntesic retitled this revision from "[Debugify] Limit number of processed instructions for original mode" to "[Debugify] Limit number of processed functions for original mode".
ntesic edited the summary of this revision.
ntesic added a comment.
Herald added a project: All.
Set limitation granularity to the function level instead of instruction level.
- After latest update of D115622 <https://reviews.llvm.org/D115622>, we decide whether to use already collected Debug Info at the Function level, instead of the (whole) Module level. This is important, since the set of observed Functions in the same Module is not the equivalent for each pass in the LLVM pipeline. This update of the patch introduces the limit number of the observed Functions in the ``` -verify-each-debuginfo-preserve ``` pipeline.
- By default, consider unlimited number of Functions
- Set any number as a limit using the ``` -debugify-func-limit ``` option
- Rebase
Sorry for the big delay, and thanks @StephenTozer for the comments!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115714/new/
https://reviews.llvm.org/D115714
Files:
llvm/lib/Transforms/Utils/Debugify.cpp
llvm/test/Transforms/Util/Debugify/loc-only-original-mode.ll
Index: llvm/test/Transforms/Util/Debugify/loc-only-original-mode.ll
===================================================================
--- llvm/test/Transforms/Util/Debugify/loc-only-original-mode.ll
+++ llvm/test/Transforms/Util/Debugify/loc-only-original-mode.ll
@@ -6,6 +6,15 @@
; RUN: -verify-each-debuginfo-preserve \
; RUN: -debugify-level=location+variables -S 2>&1 | FileCheck %s --check-prefix=CHECK-DROP
+; RUN: opt < %s -deadargelim -enable-new-pm=false \
+; RUN: -verify-each-debuginfo-preserve \
+; RUN: -debugify-func-limit=0 -S 2>&1 | FileCheck %s
+
+; RUN: opt < %s -deadargelim -enable-new-pm=false \
+; RUN: -verify-each-debuginfo-preserve \
+; RUN: -debugify-func-limit=2 -S 2>&1 | FileCheck %s --check-prefix=CHECK-DROP
+
+
; CHECK-NOT: drops dbg.value()/dbg.declare()
; CHECK-DROP: drops dbg.value()/dbg.declare()
Index: llvm/lib/Transforms/Utils/Debugify.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Debugify.cpp
+++ llvm/lib/Transforms/Utils/Debugify.cpp
@@ -37,6 +37,11 @@
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 @@
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 @@
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 @@
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115714.418545.patch
Type: text/x-patch
Size: 2339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220328/3e89a162/attachment.bin>
More information about the llvm-commits
mailing list