207
|
1 /// We support coverage versions 3.4, 4.7 and 4.8.
|
|
2 /// 3.4 redesigns the format and changed .da to .gcda
|
173
|
3 /// 4.7 enables cfg_checksum.
|
|
4 /// 4.8 (default, compatible with gcov 7) emits the exit block the second.
|
207
|
5 // RUN: %clang_cc1 -emit-llvm -disable-red-zone -fprofile-arcs -coverage-version='304*' %s -o - | \
|
|
6 // RUN: FileCheck --check-prefixes=CHECK,304 %s
|
|
7 // RUN: %clang_cc1 -emit-llvm -disable-red-zone -fprofile-arcs -coverage-version='407*' %s -o - | \
|
173
|
8 // RUN: FileCheck --check-prefixes=CHECK,407 %s
|
207
|
9 // RUN: %clang_cc1 -emit-llvm -disable-red-zone -fprofile-arcs %s -o - | \
|
173
|
10 // RUN: FileCheck --check-prefixes=CHECK,408 %s
|
|
11
|
207
|
12 // RUN: %clang_cc1 -emit-llvm -disable-red-zone -fprofile-arcs -coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda -debug-info-kind=limited -dwarf-version=4 %s -o - | FileCheck %s --check-prefix GCOV_FILE_INFO
|
150
|
13
|
207
|
14 // RUN: %clang_cc1 -emit-llvm-bc -o /dev/null -fexperimental-new-pass-manager -fdebug-pass-manager -fprofile-arcs %s 2>&1 | FileCheck --check-prefix=NEWPM %s
|
|
15 // RUN: %clang_cc1 -emit-llvm-bc -o /dev/null -fexperimental-new-pass-manager -fdebug-pass-manager -fprofile-arcs -O3 %s 2>&1 | FileCheck --check-prefix=NEWPM-O3 %s
|
150
|
16
|
|
17 // NEWPM-NOT: Running pass
|
|
18 // NEWPM: Running pass: GCOVProfilerPass
|
|
19
|
|
20 // NEWPM-O3-NOT: Running pass
|
207
|
21 // NEWPM-O3: Running pass: Annotation2MetadataPass
|
150
|
22 // NEWPM-O3: Running pass: ForceFunctionAttrsPass
|
|
23 // NEWPM-O3: Running pass: GCOVProfilerPass
|
|
24
|
|
25 int test1(int a) {
|
|
26 switch (a % 2) {
|
|
27 case 0:
|
|
28 ++a;
|
|
29 case 1:
|
|
30 a /= 2;
|
|
31 }
|
|
32 return a;
|
|
33 }
|
|
34
|
|
35 int test2(int b) {
|
|
36 return b * 2;
|
|
37 }
|
|
38
|
207
|
39
|
|
40 // CHECK: @__llvm_internal_gcov_emit_function_args.0 = internal unnamed_addr constant [2 x %emit_function_args_ty]
|
|
41 // CHECK-SAME: [%emit_function_args_ty { i32 0, i32 {{[-0-9]+}}, i32 {{[-0-9]+}} }, %emit_function_args_ty { i32 1, i32 {{[-0-9]+}}, i32 {{[-0-9]+}} }]
|
173
|
42
|
207
|
43 // CHECK: @__llvm_internal_gcov_emit_file_info = internal unnamed_addr constant [1 x %file_info]
|
|
44 /// 0x3330342a '3' '0' '4' '*'
|
|
45 // 304-SAME: i32 858797098
|
|
46 /// 0x3430372a '4' '0' '7' '*'
|
|
47 // 407-SAME: i32 875575082
|
|
48 /// 0x3430382a '4' '0' '8' '*'
|
|
49 // 408-SAME: i32 875575338
|
150
|
50
|
|
51 // Check that the noredzone flag is set on the generated functions.
|
|
52
|
|
53 // CHECK: void @__llvm_gcov_writeout() unnamed_addr [[NRZ:#[0-9]+]]
|
|
54 // CHECK: void @__llvm_gcov_init() unnamed_addr [[NRZ]]
|
|
55
|
|
56 // CHECK: attributes [[NRZ]] = { {{.*}}noredzone{{.*}} }
|
|
57
|
|
58 // GCOV_FILE_INFO: !llvm.gcov = !{![[GCOV:[0-9]+]]}
|
|
59 // GCOV_FILE_INFO: ![[GCOV]] = !{!"aaa.gcno", !"bbb.gcda", !{{[0-9]+}}}
|