diff options
author | Stephen Tozer <stephen.tozer@sony.com> | 2025-04-28 15:08:18 +0100 |
---|---|---|
committer | Stephen Tozer <stephen.tozer@sony.com> | 2025-04-30 11:39:29 +0100 |
commit | 92195f6fc873cd27a5aa0852252dfe44ccdc6ea0 (patch) | |
tree | f92d5f35e7294895fb59f9139d806230b65a18b0 /llvm/lib/Transforms/Utils/Debugify.cpp | |
parent | 77581e27514db084da59738c4d26ed7e70a31736 (diff) | |
download | llvm-92195f6fc873cd27a5aa0852252dfe44ccdc6ea0.zip llvm-92195f6fc873cd27a5aa0852252dfe44ccdc6ea0.tar.gz llvm-92195f6fc873cd27a5aa0852252dfe44ccdc6ea0.tar.bz2 |
Reapply "[DLCov] Implement DebugLoc coverage tracking (#107279)"
Reapplied after fixing the config issue that was causing issues following
the previous merge.
This reverts commit fdbf073a86573c9ac4d595fac8e06d252ce1469f.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Debugify.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp index e6b5e26..d67a563 100644 --- a/llvm/lib/Transforms/Utils/Debugify.cpp +++ b/llvm/lib/Transforms/Utils/Debugify.cpp @@ -290,6 +290,16 @@ bool llvm::stripDebugifyMetadata(Module &M) { return Changed; } +bool hasLoc(const Instruction &I) { + const DILocation *Loc = I.getDebugLoc().get(); +#if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING + DebugLocKind Kind = I.getDebugLoc().getKind(); + return Loc || Kind != DebugLocKind::Normal; +#else + return Loc; +#endif +} + bool llvm::collectDebugInfoMetadata(Module &M, iterator_range<Module::iterator> Functions, DebugInfoPerPass &DebugInfoBeforePass, @@ -362,9 +372,7 @@ bool llvm::collectDebugInfoMetadata(Module &M, LLVM_DEBUG(dbgs() << " Collecting info for inst: " << I << '\n'); DebugInfoBeforePass.InstToDelete.insert({&I, &I}); - const DILocation *Loc = I.getDebugLoc().get(); - bool HasLoc = Loc != nullptr; - DebugInfoBeforePass.DILocations.insert({&I, HasLoc}); + DebugInfoBeforePass.DILocations.insert({&I, hasLoc(I)}); } } } @@ -607,10 +615,7 @@ bool llvm::checkDebugInfoMetadata(Module &M, LLVM_DEBUG(dbgs() << " Collecting info for inst: " << I << '\n'); - const DILocation *Loc = I.getDebugLoc().get(); - bool HasLoc = Loc != nullptr; - - DebugInfoAfterPass.DILocations.insert({&I, HasLoc}); + DebugInfoAfterPass.DILocations.insert({&I, hasLoc(I)}); } } } |