1+ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
12; RUN: opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=2 -S | FileCheck %s
23
34target 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"
45
56define i32 @with_dbg (ptr %a , ptr %b ) !dbg !3 {
7+ ; CHECK-LABEL: define i32 @with_dbg(
8+ ; CHECK-SAME: ptr [[A:%.*]], ptr [[B:%.*]]) comdat !dbg [[DBG3:![0-9]+]] {
9+ ; CHECK-NEXT: [[ENTRY:.*:]]
10+ ; CHECK-NEXT: call void @__sanitizer_cov_trace_pc_guard(ptr @__sancov_gen_) #[[ATTR1:[0-9]+]], !dbg [[DBG6:![0-9]+]]
11+ ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[A]], align 4
12+ ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP1]], 42
13+ ; CHECK-NEXT: br i1 [[CMP]], label %[[BB0:.*]], label %[[BB1:.*]]
14+ ; CHECK: [[BB0]]:
15+ ; CHECK-NEXT: call void @__sanitizer_cov_trace_pc_guard(ptr inttoptr (i64 add (i64 ptrtoint (ptr @__sancov_gen_ to i64), i64 4) to ptr)) #[[ATTR1]], !dbg [[DBG7:![0-9]+]]
16+ ; CHECK-NEXT: store i32 [[TMP1]], ptr [[B]], align 4
17+ ; CHECK-NEXT: br label %[[BB1]]
18+ ; CHECK: [[BB1]]:
19+ ; CHECK-NEXT: ret i32 [[TMP1]]
20+ ;
621entry:
7- %tmp1 = load i32 , ptr %a , align 4
8- %cmp = icmp eq i32 %tmp1 , 42
22+ %t = load i32 , ptr %a , align 4
23+ %cmp = icmp eq i32 %t , 42
924 br i1 %cmp , label %0 , label %1
10250 :
11- store i32 %tmp1 , ptr %b
26+ store i32 %t , ptr %b
1227 br label %1
13281 :
14- ret i32 %tmp1
29+ ret i32 %t
1530}
16- ; CHECK-LABEL: @with_dbg
17- ; CHECK-NEXT: entry:
18- ; CHECK: call void @__sanitizer_cov_trace_pc_guard(ptr @__sancov_gen_) #1, !dbg [[DBG1:![0-9]+]]
19- ; CHECK: call void @__sanitizer_cov_trace_pc_guard(ptr inttoptr (i64 add (i64 ptrtoint (ptr @__sancov_gen_ to i64), i64 4) to ptr)) #1, !dbg [[DBG2:![0-9]+]]
2031
2132define i32 @without_dbg (ptr %a , ptr %b ) {
33+ ; CHECK-LABEL: define i32 @without_dbg(
34+ ; CHECK-SAME: ptr [[A:%.*]], ptr [[B:%.*]]) comdat {
35+ ; CHECK-NEXT: [[ENTRY:.*:]]
36+ ; CHECK-NEXT: call void @__sanitizer_cov_trace_pc_guard(ptr @__sancov_gen_.1) #[[ATTR1]]
37+ ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[A]], align 4
38+ ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP1]], 42
39+ ; CHECK-NEXT: br i1 [[CMP]], label %[[BB0:.*]], label %[[BB1:.*]]
40+ ; CHECK: [[BB0]]:
41+ ; CHECK-NEXT: call void @__sanitizer_cov_trace_pc_guard(ptr inttoptr (i64 add (i64 ptrtoint (ptr @__sancov_gen_.1 to i64), i64 4) to ptr)) #[[ATTR1]]
42+ ; CHECK-NEXT: store i32 [[TMP1]], ptr [[B]], align 4
43+ ; CHECK-NEXT: br label %[[BB1]]
44+ ; CHECK: [[BB1]]:
45+ ; CHECK-NEXT: ret i32 [[TMP1]]
46+ ;
2247entry:
23- %tmp1 = load i32 , ptr %a , align 4
24- %cmp = icmp eq i32 %tmp1 , 42
48+ %t = load i32 , ptr %a , align 4
49+ %cmp = icmp eq i32 %t , 42
2550 br i1 %cmp , label %0 , label %1
26510 :
27- store i32 %tmp1 , ptr %b
52+ store i32 %t , ptr %b
2853 br label %1
29541 :
30- ret i32 %tmp1
55+ ret i32 %t
3156}
32- ; CHECK-LABEL: @without_dbg
33- ; CHECK-NEXT: entry:
34- ; CHECK: call void @__sanitizer_cov_trace_pc_guard(ptr @__sancov_gen_.1) #1
35- ; CHECK: call void @__sanitizer_cov_trace_pc_guard(ptr inttoptr (i64 add (i64 ptrtoint (ptr @__sancov_gen_.1 to i64), i64 4) to ptr)) #1
3657
3758!llvm.dbg.cu = !{!0 }
3859!llvm.module.flags = !{!2 }
@@ -46,5 +67,12 @@ entry:
4667!6 = !DILocation (line: 192 , scope: !3 )
4768!7 = !DILocation (line: 0 , scope: !3 )
4869
49- ; CHECK: [[DBG1]] = !DILocation(line: 192, scope: !3)
50- ; CHECK: [[DBG2]] = !DILocation(line: 0, scope: !3)
70+ ;.
71+ ; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C89, file: [[META1:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, nameTableKind: None)
72+ ; CHECK: [[META1]] = !DIFile(filename: "foo.c", directory: "")
73+ ; CHECK: [[DBG3]] = distinct !DISubprogram(name: "foo", scope: [[META1]], file: [[META1]], line: 190, type: [[META4:![0-9]+]], scopeLine: 192, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]])
74+ ; CHECK: [[META4]] = !DISubroutineType(types: [[META5:![0-9]+]])
75+ ; CHECK: [[META5]] = !{}
76+ ; CHECK: [[DBG6]] = !DILocation(line: 192, scope: [[DBG3]])
77+ ; CHECK: [[DBG7]] = !DILocation(line: 0, scope: [[DBG3]])
78+ ;.
0 commit comments