From 195dfd10a679ed4860200e935d1ca292d09bb64b Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Fri, 8 Dec 2017 21:57:28 +0000 Subject: [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 --- llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/test/Transforms/Mem2Reg') diff --git a/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll b/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll index b7f39947afb..a15be3854db 100644 --- a/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll +++ b/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll @@ -1,5 +1,8 @@ ; Simple sanity check testcase. Both alloca's should be eliminated. -; RUN: opt < %s -mem2reg -S | not grep alloca +; RUN: opt < %s -debugify -mem2reg -check-debugify -S | FileCheck %s + +; CHECK-NOT: alloca +; CHECK: CheckDebugify: PASS define double @testfunc(i32 %i, double %j) { %I = alloca i32 ; [#uses=4] -- cgit v1.2.3