HomePhabricator

[Debugify] Add a pass to test debug info preservation

Authored by vsk on Dec 8 2017, 1:57 PM.

Description

[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

llvm-svn: 320202

Details

Committed
vskDec 8 2017, 1:57 PM
Differential Revision
D40512: [Debugify] Add a pass to test debug info preservation
Parents
rG927604def632: [libc++] Unbreak Apple buildbots
Branches
Unknown
Tags
Unknown