mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Adding tests for DebugIR pass
- lit tests verify that each line of input LLVM IR gets a !dbg node and a corresponding entry of metadata that contains the line number - unit tests verify that DebugIR works as advertised in the interface - refactored some useful IR generation functionality from the MCJIT unit tests so it can be reused llvm-svn: 185212
This commit is contained in:
parent
dba48c062f
commit
f5547eb2d8
42
test/Transforms/DebugIR/crash.ll
Normal file
42
test/Transforms/DebugIR/crash.ll
Normal file
@ -0,0 +1,42 @@
|
||||
; ModuleID = 'crash.c'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
@.str = private unnamed_addr constant [18 x i8] c"Hello, segfault!\0A\00", align 1
|
||||
@.str1 = private unnamed_addr constant [14 x i8] c"Now crash %d\0A\00", align 1
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main(i32 %argc, i8** %argv) #0 {
|
||||
%1 = alloca i32, align 4 ;CHECK: !dbg
|
||||
%2 = alloca i32, align 4 ;CHECK-NEXT: !dbg
|
||||
%3 = alloca i8**, align 8 ;CHECK-NEXT: !dbg
|
||||
%null_ptr = alloca i32*, align 8 ;CHECK-NEXT: !dbg
|
||||
store i32 0, i32* %1 ;CHECK-NEXT: !dbg
|
||||
store i32 %argc, i32* %2, align 4 ;CHECK-NEXT: !dbg
|
||||
store i8** %argv, i8*** %3, align 8 ;CHECK-NEXT: !dbg
|
||||
store i32* null, i32** %null_ptr, align 8 ;CHECK-NEXT: !dbg
|
||||
%4 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0)) ;CHECK-NEXT: !dbg
|
||||
%5 = load i32** %null_ptr, align 8 ;CHECK-NEXT: !dbg
|
||||
%6 = load i32* %5, align 4 ;CHECK-NEXT: !dbg
|
||||
%7 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str1, i32 0, i32 0), i32 %6) ;CHECK-NEXT: !dbg
|
||||
%8 = load i32* %2, align 4 ;CHECK-NEXT: !dbg
|
||||
ret i32 %8 ;CHECK-NEXT: !dbg
|
||||
}
|
||||
|
||||
declare i32 @printf(i8*, ...) #1
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
||||
; CHECK: = metadata !{i32 14,
|
||||
; CHECK-NEXT: = metadata !{i32 15,
|
||||
; CHECK-NEXT: = metadata !{i32 16,
|
||||
; CHECK-NEXT: = metadata !{i32 17,
|
||||
; CHECK-NEXT: = metadata !{i32 18,
|
||||
; CHECK-NEXT: = metadata !{i32 19,
|
||||
; CHECK-NEXT: = metadata !{i32 20,
|
||||
; CHECK-NEXT: = metadata !{i32 21,
|
||||
; CHECK-NEXT: = metadata !{i32 22,
|
||||
; CHECK-NEXT: = metadata !{i32 23,
|
||||
|
||||
; RUN: opt %s -debug-ir -S | FileCheck %s
|
127
test/Transforms/DebugIR/exception.ll
Normal file
127
test/Transforms/DebugIR/exception.ll
Normal file
@ -0,0 +1,127 @@
|
||||
; ModuleID = 'exception.cpp'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
@_ZTIi = external constant i8*
|
||||
|
||||
; Function Attrs: uwtable
|
||||
define i32 @main(i32 %argc, i8** %argv) #0 {
|
||||
%1 = alloca i32, align 4 ; CHECK: !dbg
|
||||
%2 = alloca i32, align 4 ; CHECK-NEXT: !dbg
|
||||
%3 = alloca i8**, align 8 ; CHECK-NEXT: !dbg
|
||||
%4 = alloca i8* ; CHECK-NEXT: !dbg
|
||||
%5 = alloca i32 ; CHECK-NEXT: !dbg
|
||||
%e = alloca i32, align 4 ; CHECK-NEXT: !dbg
|
||||
%6 = alloca i32 ; CHECK-NEXT: !dbg
|
||||
store i32 0, i32* %1 ; CHECK-NEXT: !dbg
|
||||
store i32 %argc, i32* %2, align 4 ; CHECK-NEXT: !dbg
|
||||
store i8** %argv, i8*** %3, align 8 ; CHECK-NEXT: !dbg
|
||||
%7 = call i8* @__cxa_allocate_exception(i64 4) #2 ; CHECK-NEXT: !dbg
|
||||
%8 = bitcast i8* %7 to i32* ; CHECK-NEXT: !dbg
|
||||
%9 = load i32* %2, align 4 ; CHECK-NEXT: !dbg
|
||||
store i32 %9, i32* %8 ; CHECK-NEXT: !dbg
|
||||
invoke void @__cxa_throw(i8* %7, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #3
|
||||
to label %31 unwind label %10 ; CHECK: !dbg
|
||||
|
||||
; <label>:10 ; preds = %0
|
||||
%11 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
|
||||
catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK: !dbg
|
||||
%12 = extractvalue { i8*, i32 } %11, 0 ; CHECK-NEXT: !dbg
|
||||
store i8* %12, i8** %4 ; CHECK-NEXT: !dbg
|
||||
%13 = extractvalue { i8*, i32 } %11, 1 ; CHECK-NEXT: !dbg
|
||||
store i32 %13, i32* %5 ; CHECK-NEXT: !dbg
|
||||
br label %14 ; CHECK-NEXT: !dbg
|
||||
|
||||
; <label>:14 ; preds = %10
|
||||
%15 = load i32* %5 ; CHECK: !dbg
|
||||
%16 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) #2 ; CHECK-NEXT: !dbg
|
||||
%17 = icmp eq i32 %15, %16 ; CHECK-NEXT: !dbg
|
||||
br i1 %17, label %18, label %26 ; CHECK-NEXT: !dbg
|
||||
|
||||
; <label>:18 ; preds = %14
|
||||
%19 = load i8** %4 ; CHECK: !dbg
|
||||
%20 = call i8* @__cxa_begin_catch(i8* %19) #2 ; CHECK-NEXT: !dbg
|
||||
%21 = bitcast i8* %20 to i32* ; CHECK-NEXT: !dbg
|
||||
%22 = load i32* %21, align 4 ; CHECK-NEXT: !dbg
|
||||
store i32 %22, i32* %e, align 4 ; CHECK-NEXT: !dbg
|
||||
%23 = load i32* %e, align 4 ; CHECK-NEXT: !dbg
|
||||
store i32 %23, i32* %1 ; CHECK-NEXT: !dbg
|
||||
store i32 1, i32* %6 ; CHECK-NEXT: !dbg
|
||||
call void @__cxa_end_catch() #2 ; CHECK-NEXT: !dbg
|
||||
br label %24 ; CHECK-NEXT: !dbg
|
||||
|
||||
; <label>:24 ; preds = %18
|
||||
%25 = load i32* %1 ; CHECK: !dbg
|
||||
ret i32 %25 ; CHECK-NEXT: !dbg
|
||||
|
||||
; <label>:26 ; preds = %14
|
||||
%27 = load i8** %4 ; CHECK: !dbg
|
||||
%28 = load i32* %5 ; CHECK-NEXT: !dbg
|
||||
%29 = insertvalue { i8*, i32 } undef, i8* %27, 0 ; CHECK-NEXT: !dbg
|
||||
%30 = insertvalue { i8*, i32 } %29, i32 %28, 1 ; CHECK-NEXT: !dbg
|
||||
resume { i8*, i32 } %30 ; CHECK-NEXT: !dbg
|
||||
|
||||
; <label>:31 ; preds = %0
|
||||
unreachable ; CHECK: !dbg
|
||||
}
|
||||
|
||||
declare i8* @__cxa_allocate_exception(i64)
|
||||
|
||||
declare void @__cxa_throw(i8*, i8*, i8*)
|
||||
|
||||
declare i32 @__gxx_personality_v0(...)
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare i32 @llvm.eh.typeid.for(i8*) #1
|
||||
|
||||
declare i8* @__cxa_begin_catch(i8*)
|
||||
|
||||
declare void @__cxa_end_catch()
|
||||
|
||||
attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readnone }
|
||||
attributes #2 = { nounwind }
|
||||
attributes #3 = { noreturn }
|
||||
; CHECK: = metadata !{i32 16,
|
||||
; CHECK-NEXT: = metadata !{i32 17,
|
||||
; CHECK-NEXT: = metadata !{i32 18,
|
||||
; CHECK-NEXT: = metadata !{i32 19,
|
||||
; CHECK-NEXT: = metadata !{i32 20,
|
||||
; CHECK-NEXT: = metadata !{i32 21,
|
||||
; CHECK-NEXT: = metadata !{i32 22,
|
||||
; CHECK-NEXT: = metadata !{i32 24,
|
||||
|
||||
; CHECK-NEXT: = metadata !{i32 28,
|
||||
; CHECK-NEXT: = metadata !{i32 29,
|
||||
; CHECK-NEXT: = metadata !{i32 30,
|
||||
; CHECK-NEXT: = metadata !{i32 31,
|
||||
; CHECK-NEXT: = metadata !{i32 32,
|
||||
; CHECK-NEXT: = metadata !{i32 33,
|
||||
|
||||
; CHECK-NEXT: = metadata !{i32 36,
|
||||
; CHECK-NEXT: = metadata !{i32 37,
|
||||
; CHECK-NEXT: = metadata !{i32 38,
|
||||
; CHECK-NEXT: = metadata !{i32 39,
|
||||
|
||||
; CHECK-NEXT: = metadata !{i32 42,
|
||||
; CHECK-NEXT: = metadata !{i32 43,
|
||||
; CHECK-NEXT: = metadata !{i32 44,
|
||||
; CHECK-NEXT: = metadata !{i32 45,
|
||||
; CHECK-NEXT: = metadata !{i32 46,
|
||||
; CHECK-NEXT: = metadata !{i32 47,
|
||||
; CHECK-NEXT: = metadata !{i32 48,
|
||||
; CHECK-NEXT: = metadata !{i32 49,
|
||||
; CHECK-NEXT: = metadata !{i32 50,
|
||||
; CHECK-NEXT: = metadata !{i32 51,
|
||||
|
||||
; CHECK-NEXT: = metadata !{i32 54,
|
||||
; CHECK-NEXT: = metadata !{i32 55,
|
||||
|
||||
; CHECK-NEXT: = metadata !{i32 58,
|
||||
; CHECK-NEXT: = metadata !{i32 59,
|
||||
; CHECK-NEXT: = metadata !{i32 60,
|
||||
; CHECK-NEXT: = metadata !{i32 61,
|
||||
; CHECK-NEXT: = metadata !{i32 62,
|
||||
; CHECK-NEXT: = metadata !{i32 65,
|
||||
|
||||
; RUN: opt %s -debug-ir -S | FileCheck %s
|
51
test/Transforms/DebugIR/function.ll
Normal file
51
test/Transforms/DebugIR/function.ll
Normal file
@ -0,0 +1,51 @@
|
||||
; ModuleID = 'function.c'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define void @blah(i32* %i) #0 {
|
||||
%1 = alloca i32*, align 8 ; CHECK: !dbg
|
||||
store i32* %i, i32** %1, align 8 ; CHECK-NEXT: !dbg
|
||||
%2 = load i32** %1, align 8 ; CHECK-NEXT: !dbg
|
||||
%3 = load i32* %2, align 4 ; CHECK-NEXT: !dbg
|
||||
%4 = add nsw i32 %3, 1 ; CHECK-NEXT: !dbg
|
||||
store i32 %4, i32* %2, align 4 ; CHECK-NEXT: !dbg
|
||||
ret void ; CHECK-NEXT: !dbg
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main(i32 %argc, i8** %argv) #0 {
|
||||
%1 = alloca i32, align 4 ; CHECK: !dbg
|
||||
%2 = alloca i32, align 4 ; CHECK-NEXT: !dbg
|
||||
%3 = alloca i8**, align 8 ; CHECK-NEXT: !dbg
|
||||
%i = alloca i32, align 4 ; CHECK-NEXT: !dbg
|
||||
store i32 0, i32* %1 ; CHECK-NEXT: !dbg
|
||||
store i32 %argc, i32* %2, align 4 ; CHECK-NEXT: !dbg
|
||||
store i8** %argv, i8*** %3, align 8 ; CHECK-NEXT: !dbg
|
||||
store i32 7, i32* %i, align 4 ; CHECK-NEXT: !dbg
|
||||
call void @blah(i32* %i) ; CHECK-NEXT: !dbg
|
||||
%4 = load i32* %i, align 4 ; CHECK-NEXT: !dbg
|
||||
ret i32 %4 ; CHECK-NEXT: !dbg
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
; CHECK: = metadata !{i32 8,
|
||||
; CHECK-NEXT: = metadata !{i32 9,
|
||||
; CHECK-NEXT: = metadata !{i32 10,
|
||||
; CHECK-NEXT: = metadata !{i32 11,
|
||||
; CHECK-NEXT: = metadata !{i32 12,
|
||||
; CHECK-NEXT: = metadata !{i32 13,
|
||||
|
||||
; CHECK-NEXT: = metadata !{i32 18,
|
||||
; CHECK-NEXT: = metadata !{i32 19,
|
||||
; CHECK-NEXT: = metadata !{i32 20,
|
||||
; CHECK-NEXT: = metadata !{i32 21,
|
||||
; CHECK-NEXT: = metadata !{i32 22,
|
||||
; CHECK-NEXT: = metadata !{i32 23,
|
||||
; CHECK-NEXT: = metadata !{i32 24,
|
||||
; CHECK-NEXT: = metadata !{i32 25,
|
||||
; CHECK-NEXT: = metadata !{i32 26,
|
||||
; CHECK-NEXT: = metadata !{i32 27,
|
||||
; CHECK-NEXT: = metadata !{i32 28,
|
||||
|
||||
; RUN: opt %s -debug-ir -S | FileCheck %s
|
1
test/Transforms/DebugIR/lit.local.cfg
Normal file
1
test/Transforms/DebugIR/lit.local.cfg
Normal file
@ -0,0 +1 @@
|
||||
config.suffixes = ['.ll']
|
25
test/Transforms/DebugIR/simple.ll
Normal file
25
test/Transforms/DebugIR/simple.ll
Normal file
@ -0,0 +1,25 @@
|
||||
; ModuleID = 'simple.c'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main(i32 %argc, i8** %argv) #0 {
|
||||
%1 = alloca i32, align 4 ; CHECK: !dbg
|
||||
%2 = alloca i32, align 4 ; CHECK-NEXT: !dbg
|
||||
%3 = alloca i8**, align 8 ; CHECK-NEXT: !dbg
|
||||
store i32 0, i32* %1 ; CHECK-NEXT: !dbg
|
||||
store i32 %argc, i32* %2, align 4 ; CHECK-NEXT: !dbg
|
||||
store i8** %argv, i8*** %3, align 8 ; CHECK-NEXT: !dbg
|
||||
%4 = load i32* %2, align 4 ; CHECK-NEXT: !dbg
|
||||
ret i32 %4 ; CHECK-NEXT: !dbg
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
||||
; CHECK: = metadata !{i32 10,
|
||||
; CHECK-NEXT: = metadata !{i32 11,
|
||||
; CHECK-NEXT: = metadata !{i32 12,
|
||||
; CHECK-NEXT: = metadata !{i32 13,
|
||||
; CHECK-NEXT: = metadata !{i32 14,
|
||||
|
||||
; RUN: opt %s -debug-ir -S | FileCheck %s
|
24
test/Transforms/DebugIR/struct.ll
Normal file
24
test/Transforms/DebugIR/struct.ll
Normal file
@ -0,0 +1,24 @@
|
||||
; ModuleID = 'struct.cpp'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
%struct.blah = type { i32, float, i8 }
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main() #0 {
|
||||
%1 = alloca i32, align 4 ; CHECK: !dbg
|
||||
%b = alloca %struct.blah, align 4 ; CHECK-NEXT: !dbg
|
||||
store i32 0, i32* %1 ; CHECK-NEXT: !dbg
|
||||
%2 = getelementptr inbounds %struct.blah* %b, i32 0, i32 0 ; CHECK-NEXT: !dbg
|
||||
%3 = load i32* %2, align 4 ; CHECK-NEXT: !dbg
|
||||
ret i32 %3 ; CHECK-NEXT: !dbg
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
||||
; CHECK: = metadata !{i32 11,
|
||||
; CHECK-NEXT: = metadata !{i32 12,
|
||||
; CHECK-NEXT: = metadata !{i32 13,
|
||||
; CHECK-NEXT: = metadata !{i32 14,
|
||||
|
||||
; RUN: opt %s -debug-ir -S | FileCheck %s
|
93
test/Transforms/DebugIR/vector.ll
Normal file
93
test/Transforms/DebugIR/vector.ll
Normal file
@ -0,0 +1,93 @@
|
||||
; ModuleID = 'vector.cpp'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
; Function Attrs: noinline nounwind uwtable
|
||||
define <4 x float> @_Z3fooDv2_fS_(double %a.coerce, double %b.coerce) #0 {
|
||||
%1 = alloca <2 x float>, align 8 ; CHECK: !dbg
|
||||
%2 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
|
||||
%3 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
|
||||
%4 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
|
||||
%c = alloca <4 x float>, align 16 ; CHECK-NEXT: !dbg
|
||||
%5 = bitcast <2 x float>* %1 to double* ; CHECK-NEXT: !dbg
|
||||
store double %a.coerce, double* %5, align 1 ; CHECK-NEXT: !dbg
|
||||
%a = load <2 x float>* %1, align 8 ; CHECK-NEXT: !dbg
|
||||
store <2 x float> %a, <2 x float>* %2, align 8 ; CHECK-NEXT: !dbg
|
||||
%6 = bitcast <2 x float>* %3 to double* ; CHECK-NEXT: !dbg
|
||||
store double %b.coerce, double* %6, align 1 ; CHECK-NEXT: !dbg
|
||||
%b = load <2 x float>* %3, align 8 ; CHECK-NEXT: !dbg
|
||||
store <2 x float> %b, <2 x float>* %4, align 8 ; CHECK-NEXT: !dbg
|
||||
%7 = load <2 x float>* %2, align 8 ; CHECK-NEXT: !dbg
|
||||
%8 = load <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
|
||||
%9 = shufflevector <2 x float> %7, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> ; CHECK-NEXT: !dbg
|
||||
%10 = shufflevector <4 x float> %8, <4 x float> %9, <4 x i32> <i32 4, i32 1, i32 5, i32 3> ; CHECK-NEXT: !dbg
|
||||
store <4 x float> %10, <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
|
||||
%11 = load <2 x float>* %4, align 8 ; CHECK-NEXT: !dbg
|
||||
%12 = load <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
|
||||
%13 = shufflevector <2 x float> %11, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> ; CHECK-NEXT: !dbg
|
||||
%14 = shufflevector <4 x float> %12, <4 x float> %13, <4 x i32> <i32 0, i32 4, i32 2, i32 5> ; CHECK-NEXT: !dbg
|
||||
store <4 x float> %14, <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
|
||||
%15 = load <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
|
||||
ret <4 x float> %15 ; CHECK-NEXT: !dbg
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main() #1 {
|
||||
%1 = alloca i32, align 4 ; CHECK: !dbg
|
||||
%a = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
|
||||
%b = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
|
||||
%x = alloca <4 x float>, align 16 ; CHECK-NEXT: !dbg
|
||||
%2 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
|
||||
%3 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
|
||||
store i32 0, i32* %1 ; CHECK-NEXT: !dbg
|
||||
store <2 x float> <float 1.000000e+00, float 2.000000e+00>, <2 x float>* %a, align 8 ; CHECK-NEXT: !dbg
|
||||
store <2 x float> <float 1.000000e+00, float 2.000000e+00>, <2 x float>* %b, align 8 ; CHECK-NEXT: !dbg
|
||||
%4 = load <2 x float>* %a, align 8 ; CHECK-NEXT: !dbg
|
||||
%5 = load <2 x float>* %b, align 8 ; CHECK-NEXT: !dbg
|
||||
store <2 x float> %4, <2 x float>* %2, align 8 ; CHECK-NEXT: !dbg
|
||||
%6 = bitcast <2 x float>* %2 to double* ; CHECK-NEXT: !dbg
|
||||
%7 = load double* %6, align 1 ; CHECK-NEXT: !dbg
|
||||
store <2 x float> %5, <2 x float>* %3, align 8 ; CHECK-NEXT: !dbg
|
||||
%8 = bitcast <2 x float>* %3 to double* ; CHECK-NEXT: !dbg
|
||||
%9 = load double* %8, align 1 ; CHECK-NEXT: !dbg
|
||||
%10 = call <4 x float> @_Z3fooDv2_fS_(double %7, double %9) ; CHECK-NEXT: !dbg
|
||||
store <4 x float> %10, <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
|
||||
%11 = load <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
|
||||
%12 = extractelement <4 x float> %11, i32 0 ; CHECK-NEXT: !dbg
|
||||
%13 = load <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
|
||||
%14 = extractelement <4 x float> %13, i32 1 ; CHECK-NEXT: !dbg
|
||||
%15 = fadd float %12, %14 ; CHECK-NEXT: !dbg
|
||||
%16 = load <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
|
||||
%17 = extractelement <4 x float> %16, i32 2 ; CHECK-NEXT: !dbg
|
||||
%18 = fadd float %15, %17 ; CHECK-NEXT: !dbg
|
||||
%19 = load <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
|
||||
%20 = extractelement <4 x float> %19, i32 3 ; CHECK-NEXT: !dbg
|
||||
%21 = fadd float %18, %20 ; CHECK-NEXT: !dbg
|
||||
%22 = fptosi float %21 to i32 ; CHECK-NEXT: !dbg
|
||||
ret i32 %22 ; CHECK-NEXT: !dbg
|
||||
}
|
||||
|
||||
attributes #0 = { noinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
||||
; CHECK: = metadata !{i32 13,
|
||||
; CHECK-NEXT: = metadata !{i32 14,
|
||||
; CHECK-NEXT: = metadata !{i32 15,
|
||||
; CHECK-NEXT: = metadata !{i32 16,
|
||||
; CHECK-NEXT: = metadata !{i32 17,
|
||||
; CHECK-NEXT: = metadata !{i32 18,
|
||||
; CHECK-NEXT: = metadata !{i32 19,
|
||||
; CHECK-NEXT: = metadata !{i32 20,
|
||||
; CHECK-NEXT: = metadata !{i32 21,
|
||||
; CHECK-NEXT: = metadata !{i32 22,
|
||||
; CHECK-NEXT: = metadata !{i32 23,
|
||||
; CHECK-NEXT: = metadata !{i32 24,
|
||||
; CHECK-NEXT: = metadata !{i32 25,
|
||||
; CHECK-NEXT: = metadata !{i32 26,
|
||||
; CHECK-NEXT: = metadata !{i32 27,
|
||||
; CHECK-NEXT: = metadata !{i32 28,
|
||||
; CHECK-NEXT: = metadata !{i32 29,
|
||||
; CHECK-NEXT: = metadata !{i32 30,
|
||||
; CHECK-NEXT: = metadata !{i32 31,
|
||||
|
||||
; RUN: opt %s -debug-ir -S | FileCheck %s
|
@ -30,42 +30,19 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCJITTestBase : public MCJITTestAPICommon {
|
||||
/// Helper class that can build very simple Modules
|
||||
class TrivialModuleBuilder {
|
||||
protected:
|
||||
LLVMContext Context;
|
||||
IRBuilder<> Builder;
|
||||
std::string BuilderTriple;
|
||||
|
||||
MCJITTestBase()
|
||||
: OptLevel(CodeGenOpt::None)
|
||||
, RelocModel(Reloc::Default)
|
||||
, CodeModel(CodeModel::Default)
|
||||
, MArch("")
|
||||
, Builder(Context)
|
||||
, MM(new SectionMemoryManager)
|
||||
{
|
||||
// The architectures below are known to be compatible with MCJIT as they
|
||||
// are copied from test/ExecutionEngine/MCJIT/lit.local.cfg and should be
|
||||
// kept in sync.
|
||||
SupportedArchs.push_back(Triple::aarch64);
|
||||
SupportedArchs.push_back(Triple::arm);
|
||||
SupportedArchs.push_back(Triple::x86);
|
||||
SupportedArchs.push_back(Triple::x86_64);
|
||||
TrivialModuleBuilder(const std::string &Triple)
|
||||
: Builder(Context), BuilderTriple(Triple) {}
|
||||
|
||||
// Some architectures have sub-architectures in which tests will fail, like
|
||||
// ARM. These two vectors will define if they do have sub-archs (to avoid
|
||||
// extra work for those who don't), and if so, if they are listed to work
|
||||
HasSubArchs.push_back(Triple::arm);
|
||||
SupportedSubArchs.push_back("armv6");
|
||||
SupportedSubArchs.push_back("armv7");
|
||||
|
||||
// The operating systems below are known to be incompatible with MCJIT as
|
||||
// they are copied from the test/ExecutionEngine/MCJIT/lit.local.cfg and
|
||||
// should be kept in sync.
|
||||
UnsupportedOSs.push_back(Triple::Cygwin);
|
||||
UnsupportedOSs.push_back(Triple::Darwin);
|
||||
}
|
||||
|
||||
Module *createEmptyModule(StringRef Name) {
|
||||
Module *createEmptyModule(StringRef Name = StringRef()) {
|
||||
Module * M = new Module(Name, Context);
|
||||
M->setTargetTriple(Triple::normalize(HostTriple));
|
||||
M->setTargetTriple(Triple::normalize(BuilderTriple));
|
||||
return M;
|
||||
}
|
||||
|
||||
@ -161,6 +138,40 @@ protected:
|
||||
name);
|
||||
return Global;
|
||||
}
|
||||
};
|
||||
|
||||
class MCJITTestBase : public MCJITTestAPICommon, public TrivialModuleBuilder {
|
||||
protected:
|
||||
|
||||
MCJITTestBase()
|
||||
: TrivialModuleBuilder(HostTriple)
|
||||
, OptLevel(CodeGenOpt::None)
|
||||
, RelocModel(Reloc::Default)
|
||||
, CodeModel(CodeModel::Default)
|
||||
, MArch("")
|
||||
, MM(new SectionMemoryManager)
|
||||
{
|
||||
// The architectures below are known to be compatible with MCJIT as they
|
||||
// are copied from test/ExecutionEngine/MCJIT/lit.local.cfg and should be
|
||||
// kept in sync.
|
||||
SupportedArchs.push_back(Triple::aarch64);
|
||||
SupportedArchs.push_back(Triple::arm);
|
||||
SupportedArchs.push_back(Triple::x86);
|
||||
SupportedArchs.push_back(Triple::x86_64);
|
||||
|
||||
// Some architectures have sub-architectures in which tests will fail, like
|
||||
// ARM. These two vectors will define if they do have sub-archs (to avoid
|
||||
// extra work for those who don't), and if so, if they are listed to work
|
||||
HasSubArchs.push_back(Triple::arm);
|
||||
SupportedSubArchs.push_back("armv6");
|
||||
SupportedSubArchs.push_back("armv7");
|
||||
|
||||
// The operating systems below are known to be incompatible with MCJIT as
|
||||
// they are copied from the test/ExecutionEngine/MCJIT/lit.local.cfg and
|
||||
// should be kept in sync.
|
||||
UnsupportedOSs.push_back(Triple::Cygwin);
|
||||
UnsupportedOSs.push_back(Triple::Darwin);
|
||||
}
|
||||
|
||||
void createJIT(Module *M) {
|
||||
|
||||
@ -186,14 +197,12 @@ protected:
|
||||
assert(TheJIT.get() != NULL && "error creating MCJIT with EngineBuilder");
|
||||
}
|
||||
|
||||
LLVMContext Context;
|
||||
CodeGenOpt::Level OptLevel;
|
||||
Reloc::Model RelocModel;
|
||||
CodeModel::Model CodeModel;
|
||||
StringRef MArch;
|
||||
SmallVector<std::string, 1> MAttrs;
|
||||
OwningPtr<ExecutionEngine> TheJIT;
|
||||
IRBuilder<> Builder;
|
||||
RTDyldMemoryManager *MM;
|
||||
|
||||
OwningPtr<Module> M;
|
||||
|
@ -1 +1,2 @@
|
||||
add_subdirectory(DebugIR)
|
||||
add_subdirectory(Utils)
|
||||
|
7
unittests/Transforms/DebugIR/CMakeLists.txt
Normal file
7
unittests/Transforms/DebugIR/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
Instrumentation
|
||||
)
|
||||
|
||||
add_llvm_unittest(DebugIRTests
|
||||
DebugIR.cpp
|
||||
)
|
296
unittests/Transforms/DebugIR/DebugIR.cpp
Normal file
296
unittests/Transforms/DebugIR/DebugIR.cpp
Normal file
@ -0,0 +1,296 @@
|
||||
//===- DebugIR.cpp - Unit tests for the DebugIR pass ----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The tests in this file verify the DebugIR pass that generates debug metadata
|
||||
// for LLVM IR.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/Config/config.h"
|
||||
#include "llvm/DebugInfo.h"
|
||||
#include "llvm/DIBuilder.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
|
||||
#include "../lib/Transforms/Instrumentation/DebugIR.h"
|
||||
|
||||
// These tests do not depend on MCJIT, but we use the TrivialModuleBuilder
|
||||
// helper class to construct some trivial Modules.
|
||||
#include "../unittests/ExecutionEngine/MCJIT/MCJITTestBase.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
|
||||
/// Insert a mock CUDescriptor with the specified producer
|
||||
void insertCUDescriptor(Module *M, StringRef File, StringRef Dir,
|
||||
StringRef Producer) {
|
||||
DIBuilder B(*M);
|
||||
B.createCompileUnit(dwarf::DW_LANG_C99, File, Dir, Producer, false, "", 0);
|
||||
B.finalize();
|
||||
}
|
||||
|
||||
/// Attempts to remove file at Path and returns true if it existed, or false if
|
||||
/// it did not.
|
||||
bool removeIfExists(StringRef Path) {
|
||||
bool existed = false;
|
||||
sys::fs::remove(Path, existed);
|
||||
return existed;
|
||||
}
|
||||
|
||||
class TestDebugIR : public ::testing::Test, public TrivialModuleBuilder {
|
||||
protected:
|
||||
TestDebugIR()
|
||||
: TrivialModuleBuilder(sys::getProcessTriple())
|
||||
#ifdef HAVE_GETCWD
|
||||
,
|
||||
cwd(get_current_dir_name())
|
||||
#else
|
||||
,
|
||||
cwd(0)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
~TestDebugIR() { free(cwd); }
|
||||
|
||||
/// Returns a concatenated path string consisting of Dir and Filename
|
||||
string getPath(const string &Dir, const string &Filename) {
|
||||
SmallVector<char, 8> Path;
|
||||
sys::path::append(Path, Dir, Filename);
|
||||
Path.resize(Dir.size() + Filename.size() + 2);
|
||||
Path[Dir.size() + Filename.size() + 1] = '\0';
|
||||
return string(Path.data());
|
||||
}
|
||||
|
||||
LLVMContext Context;
|
||||
char *cwd;
|
||||
OwningPtr<Module> M;
|
||||
OwningPtr<DebugIR> D;
|
||||
};
|
||||
|
||||
// Test empty named Module that is not supposed to be output to disk.
|
||||
TEST_F(TestDebugIR, EmptyNamedModuleNoWrite) {
|
||||
string name = "/mock/path/to/empty_module.ll";
|
||||
M.reset(createEmptyModule(name));
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass()));
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
|
||||
// verify DebugIR was able to correctly parse the file name from module ID
|
||||
ASSERT_EQ(Path, name);
|
||||
|
||||
// verify DebugIR did not generate a file
|
||||
ASSERT_FALSE(removeIfExists(Path)) << "Unexpected file " << Path;
|
||||
}
|
||||
|
||||
// Test a non-empty unnamed module that is output to an autogenerated file name.
|
||||
TEST_F(TestDebugIR, NonEmptyUnnamedModuleWriteToAutogeneratedFile) {
|
||||
M.reset(createEmptyModule());
|
||||
insertAddFunction(M.get());
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass(true, true)));
|
||||
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
|
||||
// verify DebugIR generated a file, and clean it up
|
||||
ASSERT_TRUE(removeIfExists(Path)) << "Missing expected file at " << Path;
|
||||
}
|
||||
|
||||
// Test not specifying a name in the module -- DebugIR should generate a name
|
||||
// and write the file contents.
|
||||
TEST_F(TestDebugIR, EmptyModuleWriteAnonymousFile) {
|
||||
M.reset(createEmptyModule());
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass(false, false)));
|
||||
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
|
||||
// verify DebugIR generated a file and clean it up
|
||||
ASSERT_TRUE(removeIfExists(Path)) << "Missing expected file at " << Path;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GETCWD // These tests require get_current_dir_name()
|
||||
|
||||
// Test empty named Module that is to be output to path specified at Module
|
||||
// construction.
|
||||
TEST_F(TestDebugIR, EmptyNamedModuleWriteFile) {
|
||||
string Filename("NamedFile1");
|
||||
string ExpectedPath(getPath(cwd, Filename));
|
||||
|
||||
M.reset(createEmptyModule(ExpectedPath));
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass(true, true)));
|
||||
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
|
||||
// verify DebugIR was able to correctly parse the file name from module ID
|
||||
ASSERT_EQ(ExpectedPath, Path);
|
||||
|
||||
// verify DebugIR generated a file, and clean it up
|
||||
ASSERT_TRUE(removeIfExists(Path)) << "Missing expected file at " << Path;
|
||||
}
|
||||
|
||||
// Test an empty unnamed module generates an output file whose path is specified
|
||||
// at DebugIR construction.
|
||||
TEST_F(TestDebugIR, EmptyUnnamedModuleWriteNamedFile) {
|
||||
string Filename("NamedFile2");
|
||||
|
||||
M.reset(createEmptyModule());
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass(
|
||||
false, false, StringRef(cwd), StringRef(Filename))));
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
|
||||
string ExpectedPath(getPath(cwd, Filename));
|
||||
ASSERT_EQ(ExpectedPath, Path);
|
||||
|
||||
// verify DebugIR generated a file, and clean it up
|
||||
ASSERT_TRUE(removeIfExists(Path)) << "Missing expected file at " << Path;
|
||||
}
|
||||
|
||||
// Test an empty named module generates an output file at the path specified
|
||||
// during DebugIR construction.
|
||||
TEST_F(TestDebugIR, EmptyNamedModuleWriteNamedFile) {
|
||||
string Filename("NamedFile3");
|
||||
|
||||
string UnexpectedPath(getPath(cwd, "UnexpectedFilename"));
|
||||
M.reset(createEmptyModule(UnexpectedPath));
|
||||
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass(
|
||||
false, false, StringRef(cwd), StringRef(Filename))));
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
|
||||
string ExpectedPath(getPath(cwd, Filename));
|
||||
ASSERT_EQ(ExpectedPath, Path);
|
||||
|
||||
// verify DebugIR generated a file, and clean it up
|
||||
ASSERT_TRUE(removeIfExists(Path)) << "Missing expected file at " << Path;
|
||||
|
||||
// verify DebugIR did not generate a file at the path specified at Module
|
||||
// construction.
|
||||
ASSERT_FALSE(removeIfExists(UnexpectedPath)) << "Unexpected file " << Path;
|
||||
}
|
||||
|
||||
// Test a non-empty named module that is not supposed to be output to disk
|
||||
TEST_F(TestDebugIR, NonEmptyNamedModuleNoWrite) {
|
||||
string Filename("NamedFile4");
|
||||
string ExpectedPath(getPath(cwd, Filename));
|
||||
|
||||
M.reset(createEmptyModule(ExpectedPath));
|
||||
insertAddFunction(M.get());
|
||||
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass()));
|
||||
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
ASSERT_EQ(ExpectedPath, Path);
|
||||
|
||||
// verify DebugIR did not generate a file
|
||||
ASSERT_FALSE(removeIfExists(Path)) << "Unexpected file " << Path;
|
||||
}
|
||||
|
||||
// Test a non-empty named module that is output to disk.
|
||||
TEST_F(TestDebugIR, NonEmptyNamedModuleWriteFile) {
|
||||
string Filename("NamedFile5");
|
||||
string ExpectedPath(getPath(cwd, Filename));
|
||||
|
||||
M.reset(createEmptyModule(ExpectedPath));
|
||||
insertAddFunction(M.get());
|
||||
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass(true, true)));
|
||||
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
ASSERT_EQ(ExpectedPath, Path);
|
||||
|
||||
// verify DebugIR generated a file, and clean it up
|
||||
ASSERT_TRUE(removeIfExists(Path)) << "Missing expected file at " << Path;
|
||||
}
|
||||
|
||||
// Test a non-empty unnamed module is output to a path specified at DebugIR
|
||||
// construction.
|
||||
TEST_F(TestDebugIR, NonEmptyUnnamedModuleWriteToNamedFile) {
|
||||
string Filename("NamedFile6");
|
||||
|
||||
M.reset(createEmptyModule());
|
||||
insertAddFunction(M.get());
|
||||
|
||||
D.reset(static_cast<DebugIR *>(
|
||||
llvm::createDebugIRPass(true, true, cwd, Filename)));
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
|
||||
string ExpectedPath(getPath(cwd, Filename));
|
||||
ASSERT_EQ(ExpectedPath, Path);
|
||||
|
||||
// verify DebugIR generated a file, and clean it up
|
||||
ASSERT_TRUE(removeIfExists(Path)) << "Missing expected file at " << Path;
|
||||
}
|
||||
|
||||
// Test that information inside existing debug metadata is retained
|
||||
TEST_F(TestDebugIR, ExistingMetadataRetained) {
|
||||
string Filename("NamedFile7");
|
||||
string ExpectedPath(getPath(cwd, Filename));
|
||||
|
||||
M.reset(createEmptyModule(ExpectedPath));
|
||||
insertAddFunction(M.get());
|
||||
|
||||
StringRef Producer("TestProducer");
|
||||
insertCUDescriptor(M.get(), Filename, cwd, Producer);
|
||||
|
||||
DebugInfoFinder Finder;
|
||||
Finder.processModule(*M);
|
||||
ASSERT_EQ((unsigned)1, Finder.compile_unit_count());
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass()));
|
||||
|
||||
string Path;
|
||||
D->runOnModule(*M, Path);
|
||||
ASSERT_EQ(ExpectedPath, Path);
|
||||
|
||||
// verify DebugIR did not generate a file
|
||||
ASSERT_FALSE(removeIfExists(Path)) << "Unexpected file " << Path;
|
||||
|
||||
DICompileUnit CU(*Finder.compile_unit_begin());
|
||||
|
||||
// Verify original CU information is retained
|
||||
ASSERT_EQ(Filename, CU.getFilename());
|
||||
ASSERT_EQ(cwd, CU.getDirectory());
|
||||
ASSERT_EQ(Producer, CU.getProducer());
|
||||
}
|
||||
|
||||
#endif // HAVE_GETCWD
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Test a non-empty unnamed module that is not supposed to be output to disk
|
||||
// NOTE: this test is expected to die with LLVM_ERROR, and such depends on
|
||||
// google test's "death test" mode.
|
||||
TEST_F(TestDebugIR, NonEmptyUnnamedModuleNoWrite) {
|
||||
M.reset(createEmptyModule(StringRef()));
|
||||
insertAddFunction(M.get());
|
||||
D.reset(static_cast<DebugIR *>(llvm::createDebugIRPass()));
|
||||
|
||||
// No name in module or on DebugIR construction ==> DebugIR should assert
|
||||
EXPECT_DEATH(D->runOnModule(*M),
|
||||
"DebugIR unable to determine file name in input.");
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
}
|
15
unittests/Transforms/DebugIR/Makefile
Normal file
15
unittests/Transforms/DebugIR/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
##===- unittests/Transforms/Utils/Makefile -----------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../../..
|
||||
TESTNAME = DebugIR
|
||||
LINK_COMPONENTS := Instrumentation
|
||||
|
||||
include $(LEVEL)/Makefile.config
|
||||
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
|
@ -9,7 +9,7 @@
|
||||
|
||||
LEVEL = ../..
|
||||
|
||||
PARALLEL_DIRS = Utils
|
||||
PARALLEL_DIRS = DebugIR Utils
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user