[PATCH] D81939: [NOT FOR COMMIT] [deadargelim] Attach dbg info to the insert/extractvalue instructions

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 17 01:34:55 PDT 2020


djtodoro added a comment.

In D81939#2096463 <https://reviews.llvm.org/D81939#2096463>, @vsk wrote:

> Hi @djtodoro, this popped up in my mail filter so I thought I'd drop a line :). It sounds like there's a substantial amount of overlap with the debugify stuff and the tool here (https://github.com/djolertrk/llvm-di-checker). Do we need both?
>
> For the issue found here for example, one might do: `./bin/llvm-lit -Dopt="opt -debugify-each" test/Transforms/DeadArgElim -av 2>&1 | less`, and this prints:
>
>   PASS: LLVM :: Transforms/DeadArgElim/multdeadretval.ll (28 of 34)
>   Script:
>   --
>   : 'RUN: at line 5';   opt -debugify-each < /Users/vsk/src/llvm-project-master/llvm/test/Transforms/DeadArgElim/multdeadretval.ll -deadargelim -instcombine -dce -S | /Users/vsk/src/builds/llvm-project-master-RA/bin/not grep i16
>   --
>   Exit Code: 0
>  
>   Command Output (stderr):
>   --
>   ERROR: Instruction with empty DebugLoc in function test --  %oldret = extractvalue { i16, i32 } %B, 1
>   ERROR: Instruction with empty DebugLoc in function test2 --  %oldret = extractvalue { i32, i16 } %B, 0
>   ERROR: Instruction with empty DebugLoc in function test3 --  %oldret = insertvalue { i16, i32 } undef, i32 %ret, 1
>   ERROR: Instruction with empty DebugLoc in function test5 --  %oldret = extractvalue { i32, i32, i16 } %C, 0
>   ...
>
>
> I think there are advantages to looking at real code outside of the llvm unit/regression tests, just wondering whether we need to redo all the DI checking / stats collection work.


Hi @vsk, thanks for the comment! :)

The `debugify` tool is very useful for the regression testing/Pass verification; and I use it that way and I think we can all use it in the combination with this. The idea here was to introduce a tool (let me say a sibling of the `debugify`) that will deal with real debug info metadata. I know that  `debugify` already deals with the `DILocations`, but I thought to introduce support for all kind of metadata (including `DIGlobalVariables`, `DILexicalBlocks`, etc.; which is hard to maintain as synthetic debug info), and support `DILocations` along the way as well. In addition, I think that extending this to MIR level is also doable/may be straight forward.

We all use the compiler on real projects, and users report issues regarding debug info saying //"My variable 'a' is optimized out, but it should not be"// or //"I cannot attach breakpoint to function 'f' (or instruction 'i')"//, so I found this tool very useful in these situations, since it points (or it will point when improved; this is initial stage) to real spot of the bug that caused the issue for the concrete entity. Also, there are companies with downstream passes and frontend features that may not be direct cause of the bug, but the bug can occur somewhere else in the pipeline as a consequence. So, I think (by using this) we can come up with variety of test cases that may not be present in the existing tests.

I'll send an RFC and please comment on that! Thanks again!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81939/new/

https://reviews.llvm.org/D81939





More information about the llvm-commits mailing list