OSDN Git Service

[Debugify] Add a pass to test debug info preservation
authorVedant Kumar <vsk@apple.com>
Fri, 8 Dec 2017 21:57:28 +0000 (21:57 +0000)
committerVedant Kumar <vsk@apple.com>
Fri, 8 Dec 2017 21:57:28 +0000 (21:57 +0000)
commit2cac108e9753326b180ea630bd6272eaacfe80a5
treebf2a5cb6015cd56774ab6ac76e36d3b866510220
parent976af3f5de33b23aeabdfe92e6089782124f9b62
[Debugify] Add a pass to test debug info preservation

The Debugify pass synthesizes debug info for IR. It's paired with a
CheckDebugify pass which determines how much of the original debug info
is preserved. These passes make it easier to create targeted tests for
debug info preservation.

Here is the Debugify algorithm:

  NextLine = 1
  for (Instruction &I : M)
    attach DebugLoc(NextLine++) to I

  NextVar = 1
  for (Instruction &I : M)
    if (canAttachDebugValue(I))
      attach dbg.value(NextVar++) to I

The CheckDebugify pass expects contiguous ranges of DILocations and
DILocalVariables. If it fails to find all of the expected debug info, it
prints a specific error to stderr which can be FileChecked.

This was discussed on llvm-dev in the thread:
"Passes to add/validate synthetic debug info"

Differential Revision: https://reviews.llvm.org/D40512

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320202 91177308-0d34-0410-b5e6-96231b3b80d8
docs/ReleaseNotes.rst
test/DebugInfo/debugify.ll [new file with mode: 0644]
test/Transforms/Mem2Reg/PromoteMemToRegister.ll
tools/opt/CMakeLists.txt
tools/opt/Debugify.cpp [new file with mode: 0644]