diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2020-04-03 15:50:11 -0700 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2020-04-06 15:04:55 -0700 |
commit | 15f7bc78572543d75f56d1e7989801a2ac08c430 (patch) | |
tree | 02bd2b3cf67cdee1b4ad95e04a7670c18452b81a /llvm/lib/Transforms/Utils/Debugify.cpp | |
parent | 41610d665013d716da245175ada1d9c5a8b79558 (diff) | |
download | llvm-15f7bc78572543d75f56d1e7989801a2ac08c430.zip llvm-15f7bc78572543d75f56d1e7989801a2ac08c430.tar.gz llvm-15f7bc78572543d75f56d1e7989801a2ac08c430.tar.bz2 |
Add option to limit Debugify to locations (omitting variables)
Summary:
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.
Reviewers: aprantl, bogner
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77438
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Debugify.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp index b1274d9..a9cdf65 100644 --- a/llvm/lib/Transforms/Utils/Debugify.cpp +++ b/llvm/lib/Transforms/Utils/Debugify.cpp @@ -30,6 +30,17 @@ namespace { 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 @@ bool applyDebugifyMetadata(Module &M, 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; |