[PATCH] D77438: Add option to limit Debugify to locations (omitting variables)
Daniel Sanders via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 3 16:49:10 PDT 2020
dsanders created this revision.
dsanders added reviewers: aprantl, bogner.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
It can be helpful to test behaviour w.r.t locations without having DEBUG_VALUE
around. In particular, because DEBUG_VALUE has the potential to change CodeGen
behaviour (e.g. hasOneUse() vs hasOneNonDbgUse()) while locations generally
don't.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77438
Files:
llvm/lib/Transforms/Utils/Debugify.cpp
Index: llvm/lib/Transforms/Utils/Debugify.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Debugify.cpp
+++ llvm/lib/Transforms/Utils/Debugify.cpp
@@ -30,6 +30,17 @@
cl::opt<bool> Quiet("debugify-quiet",
cl::desc("Suppress verbose debugify output"));
+enum class Level {
+ Locations,
+ LocationsAndVariables
+};
+cl::opt<Level> DebugifyLevel(
+ "debugify-level", cl::desc("Kind of debug info to add"),
+ cl::values(clEnumValN(Level::Locations, "locations", "Locations only"),
+ clEnumValN(Level::LocationsAndVariables, "location+variables",
+ "Locations and Variables")),
+ cl::init(Level::LocationsAndVariables));
+
raw_ostream &dbg() { return Quiet ? nulls() : errs(); }
uint64_t getAllocSizeInBits(Module &M, Type *Ty) {
@@ -100,6 +111,9 @@
for (Instruction &I : BB)
I.setDebugLoc(DILocation::get(Ctx, NextLine++, 1, SP));
+ if (DebugifyLevel < Level::LocationsAndVariables)
+ continue;
+
// Inserting debug values into EH pads can break IR invariants.
if (BB.isEHPad())
continue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77438.254944.patch
Type: text/x-patch
Size: 1168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200403/8670f4c0/attachment.bin>
More information about the llvm-commits
mailing list