[PATCH] D40512: WIP: [Debugify] Add a pass to test debug info preservation

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 11:55:24 PST 2017


vsk created this revision.
vsk added a project: debug-info.
Herald added subscribers: JDevlieghere, mgorny.

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.

Example usage:

  opt -debugify -mem2reg -check-debugify | grep "CheckDebugify: PASS"
  
  opt -debugify -loop-reduce -check-debugify | grep "CheckDebugify: FAIL"

TODO: Hook this up with the new pass manager.


https://reviews.llvm.org/D40512

Files:
  include/llvm/InitializePasses.h
  include/llvm/LinkAllPasses.h
  include/llvm/Transforms/IPO.h
  lib/Transforms/Utils/CMakeLists.txt
  lib/Transforms/Utils/Debugify.cpp
  lib/Transforms/Utils/Utils.cpp
  test/Transforms/Debugify/debugify.ll
  test/Transforms/LoopStrengthReduce/debug-info.ll
  test/Transforms/Mem2Reg/PromoteMemToRegister.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40512.124435.patch
Type: text/x-patch
Size: 15100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171127/e9038552/attachment.bin>


More information about the llvm-commits mailing list