[Debugify] Make the debugify aware of the original (-g) Debug Info
authorDjordje Todorovic <djordje.todorovic@syrmia.com>
Wed, 30 Sep 2020 13:06:55 +0000 (06:06 -0700)
committerDjordje Todorovic <djtodoro@cisco.com>
Thu, 18 Feb 2021 09:52:16 +0000 (01:52 -0800)
commit8ee7c7e02953fbaf946964c4ddce3962156508b5
tree637ca52b3bc3fa25e7f3b0e34497836a329955f0
parent4c23707a418add9c584af5247faa5a9527632a0c
[Debugify] Make the debugify aware of the original (-g) Debug Info

As discussed on the RFC [0], I am sharing the set of patches that
enables checking of original Debug Info metadata preservation in
optimizations. The proof-of-concept/proposal can be found at [1].

The implementation from the [1] was full of duplicated code,
so this set of patches tries to merge this approach into the existing
debugify utility.

For example, the utility pass in the original-debuginfo-check
mode could be invoked as follows:

  $ opt -verify-debuginfo-preserve -pass-to-test sample.ll

Since this is very initial stage of the implementation,
there is a space for improvements such as:
  - Add support for the new pass manager
  - Add support for metadata other than DILocations and DISubprograms

[0] https://groups.google.com/forum/#!msg/llvm-dev/QOyF-38YPlE/G213uiuwCAAJ
[1] https://github.com/djolertrk/llvm-di-checker

Differential Revision: https://reviews.llvm.org/D82545
llvm/docs/HowToUpdateDebugInfo.rst
llvm/include/llvm/Transforms/Utils/Debugify.h
llvm/lib/Transforms/Utils/Debugify.cpp
llvm/test/DebugInfo/debugify-original-no-dbg-info.ll [new file with mode: 0644]
llvm/tools/opt/opt.cpp
llvm/unittests/Transforms/Utils/CMakeLists.txt
llvm/unittests/Transforms/Utils/DebugifyTest.cpp [new file with mode: 0644]