aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorStephen Tozer <stephen.tozer@sony.com>2025-04-28 15:08:18 +0100
committerStephen Tozer <stephen.tozer@sony.com>2025-04-30 11:39:29 +0100
commit92195f6fc873cd27a5aa0852252dfe44ccdc6ea0 (patch)
treef92d5f35e7294895fb59f9139d806230b65a18b0 /clang/lib/CodeGen/BackendUtil.cpp
parent77581e27514db084da59738c4d26ed7e70a31736 (diff)
downloadllvm-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 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 2271f01..c9ceb49 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -962,6 +962,22 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
Debugify.setOrigDIVerifyBugsReportFilePath(
CodeGenOpts.DIBugsReportFilePath);
Debugify.registerCallbacks(PIC, MAM);
+
+#if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
+ // If we're using debug location coverage tracking, mark all the
+ // instructions coming out of the frontend without a DebugLoc as being
+ // compiler-generated, to prevent both those instructions and new
+ // instructions that inherit their location from being treated as
+ // incorrectly empty locations.
+ for (Function &F : *TheModule) {
+ if (!F.getSubprogram())
+ continue;
+ for (BasicBlock &BB : F)
+ for (Instruction &I : BB)
+ if (!I.getDebugLoc())
+ I.setDebugLoc(DebugLoc::getCompilerGenerated());
+ }
+#endif
}
// Attempt to load pass plugins and register their callbacks with PB.
for (auto &PluginFN : CodeGenOpts.PassPlugins) {