diff options
author | Stephen Tozer <stephen.tozer@sony.com> | 2025-08-15 14:01:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-15 14:01:04 +0100 |
commit | bc216b057d8bba98c99f82ddeb27da63759d20ad (patch) | |
tree | b889cfc9809c6c1f2bb61bf33038b2bbb9fb75fa /llvm/lib/Transforms/Utils/Debugify.cpp | |
parent | bcb4984a0b75862c43d7603124efcf76def1a5f3 (diff) | |
download | llvm-bc216b057d8bba98c99f82ddeb27da63759d20ad.zip llvm-bc216b057d8bba98c99f82ddeb27da63759d20ad.tar.gz llvm-bc216b057d8bba98c99f82ddeb27da63759d20ad.tar.bz2 |
[Debugify] Improve reduction of debugify coverage build output (#150212)
In current DebugLoc coverage builds, the output for any reasonably large
build can become very large if any missing DebugLocs are present; this
happens because single errors in LLVM may result in many errors being
reported in the output report. The main cause of this is that the empty
locations attached to instructions may be propagated to other
instructions in later passes, which will each be reported as new errors.
This patch prevents this by adding an "unknown" annotation to
instructions after reporting them once, ensuring that any other
DebugLocs copied or derived from the original empty location will not be
marked as new errors.
As a separate but related change, this patch updates the report
generation script to deduplicate results using the recorded stacktrace
if they are available, instead of the pass+instruction combination. This
reduces the size of the reduction, but makes the reduction highly
reliable, as the stacktrace allows us to very precisely identify when
two bugs have originated from the same place.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Debugify.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp index 291e2a5..a0b7fdb 100644 --- a/llvm/lib/Transforms/Utils/Debugify.cpp +++ b/llvm/lib/Transforms/Utils/Debugify.cpp @@ -706,6 +706,15 @@ bool llvm::checkDebugInfoMetadata(Module &M, DILocsBefore, DILocsAfter, InstToDelete, NameOfWrappedPass, FileNameFromCU, ShouldWriteIntoJSON, Bugs); +#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE + // If we are tracking DebugLoc coverage, replace each empty DebugLoc with an + // annotated location now so that it does not show up in future passes even if + // it is propagated to other instructions. + for (auto &L : DILocsAfter) + if (!L.second) + L.first->setDebugLoc(DebugLoc::getUnknown()); +#endif + bool ResultForVars = checkVars(DIVarsBefore, DIVarsAfter, NameOfWrappedPass, FileNameFromCU, ShouldWriteIntoJSON, Bugs); |