aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Debugify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Debugify.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index 84fe656..d6b1b1b 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -42,7 +42,6 @@ enum class Level {
LocationsAndVariables
};
-// Used for the synthetic mode only.
cl::opt<Level> DebugifyLevel(
"debugify-level", cl::desc("Kind of debug info to add"),
cl::values(clEnumValN(Level::Locations, "locations", "Locations only"),
@@ -321,20 +320,22 @@ bool llvm::collectDebugInfoMetadata(Module &M,
if (isa<PHINode>(I))
continue;
- // Collect dbg.values and dbg.declares.
- if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I)) {
- if (!SP)
- continue;
- // Skip inlined variables.
- if (I.getDebugLoc().getInlinedAt())
- continue;
- // Skip undef values.
- if (DVI->isUndef())
+ // Cllect dbg.values and dbg.declare.
+ if (DebugifyLevel > Level::Locations) {
+ if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I)) {
+ if (!SP)
+ continue;
+ // Skip inlined variables.
+ if (I.getDebugLoc().getInlinedAt())
+ continue;
+ // Skip undef values.
+ if (DVI->isUndef())
+ continue;
+
+ auto *Var = DVI->getVariable();
+ DebugInfoBeforePass.DIVariables[Var]++;
continue;
-
- auto *Var = DVI->getVariable();
- DebugInfoBeforePass.DIVariables[Var]++;
- continue;
+ }
}
// Skip debug instructions other than dbg.value and dbg.declare.
@@ -556,19 +557,21 @@ bool llvm::checkDebugInfoMetadata(Module &M,
continue;
// Collect dbg.values and dbg.declares.
- if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I)) {
- if (!SP)
+ if (DebugifyLevel > Level::Locations) {
+ if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I)) {
+ if (!SP)
+ continue;
+ // Skip inlined variables.
+ if (I.getDebugLoc().getInlinedAt())
+ continue;
+ // Skip undef values.
+ if (DVI->isUndef())
+ continue;
+
+ auto *Var = DVI->getVariable();
+ DebugInfoAfterPass.DIVariables[Var]++;
continue;
- // Skip inlined variables.
- if (I.getDebugLoc().getInlinedAt())
- continue;
- // Skip undef values.
- if (DVI->isUndef())
- continue;
-
- auto *Var = DVI->getVariable();
- DebugInfoAfterPass.DIVariables[Var]++;
- continue;
+ }
}
// Skip debug instructions other than dbg.value and dbg.declare.