As discussed on the RFC , 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 .
The implementation from the  was full of duplicated code, so this set of patches tries to merge this approach into the existing `debugify` utility.
For example, The idea is to introduce two modes to the utility:the utility pass in the original-debuginfo-check mode could be invoked as follows:
- `synthetic` - everything should stay as is with the respect to the functionality of the `debugify`
- `original` - this is the new mode that should operate on the original/real Debug Info metadata
For example, the debugify in the original mode could be invoked as follows:
$ opt -enable-debugify=original$ 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