[PATCH] D147134: [RFC][Debugify] Remove false positve debug location losses

Nikola Tesic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 03:33:50 PDT 2023


ntesic created this revision.
ntesic added a project: debug-info.
Herald added subscribers: asbirlea, hiraditya.
Herald added a project: All.
ntesic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The problem of "false positive results" in Debugify reports was discussed at one of the LLVM Dev meetings. This RFC aims at solving this problem for reports about lost Debug Locations (instruction source locations).

There are several scenarios where debug locations are dropped, but should not be reported by Debugify as losses:

- instruction's DebugLoc should be dropped if it cannot be unambiguously determined (according to How-to-update-debug-info document <https://llvm.org/docs/HowToUpdateDebugInfo.html>)
- instruction's DebugLoc is copied from an other instruction (loss should not be reported for both instructions)

In my opinion, those cases should not be treated as losses, since DebugLocs are explicitly updated, but couldn't be reconstructed.

My proposal, in this patch, is to add a flag to the Instruction (`droppedLocation`), which should be set if the DebugLoc is explicitly set to empty for that instruction. Then, during Debugify analysis, we should not report DebugLoc loss if instruction's DebugLoc is explicitly updated (by checking the flag).

Proposed solution was tested by compiling clang-14 with `-fverify-debuginfo-preserve`. The results show around 65% of reported DebugLoc losses is eliminated.


https://reviews.llvm.org/D147134

Files:
  llvm/include/llvm/IR/Instruction.h
  llvm/lib/IR/DebugInfo.cpp
  llvm/lib/Transforms/Utils/Debugify.cpp
  llvm/test/DebugInfo/Generic/licm-hoist-debug-loc.ll
  llvm/test/DebugInfo/debugify.ll
  llvm/unittests/IR/InstructionsTest.cpp
  llvm/unittests/Transforms/Utils/DebugifyTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147134.509283.patch
Type: text/x-patch
Size: 10037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230329/c13847fa/attachment.bin>


More information about the llvm-commits mailing list