Debian Codegraph @

clang/test/DebugInfo/KeyInstructions/init-agg.c

raw
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -x c++ -gkey-instructions %s -debug-info-kind=line-tables-only -gno-column-info -emit-llvm -o - -ftrivial-auto-var-init=pattern \
2 // RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
3
4 // RUN: %clang_cc1 -triple x86_64-linux-gnu -x c -gkey-instructions %s -debug-info-kind=line-tables-only -gno-column-info -emit-llvm -o - -ftrivial-auto-var-init=pattern \
5 // RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
6
7 // The implicit-check-not is important; we don't want the GEPs created for the
8 // store locations to be included in the atom group.
9
10 int g;
11 void a() {
12 // CHECK: call void @llvm.memcpy{{.*}}%A{{.*}}, !dbg [[G1R1:!.*]]
13 int A[] = { 1, 2, 3 };
14
15 // CHECK: call void @llvm.memcpy{{.*}}%B{{.*}}, !dbg [[G2R1:!.*]]
16 // CHECK-NEXT: store i32 1, ptr %B{{.*}}, !dbg [[G2R1:!.*]]
17 // CHECK-NEXT: %arrayinit.element = getelementptr {{.*}}, ptr %B, {{.*}} 1, !dbg [[B_LINE:!.*]]
18 // CHECK-NEXT: store i32 2, ptr %arrayinit.element{{.*}}, !dbg [[G2R1]]
19 // CHECK-NEXT: %arrayinit.element1 = getelementptr {{.*}}, ptr %B, {{.*}} 2, !dbg [[B_LINE]]
20 // CHECK-NEXT: %0 = load i32, ptr @g{{.*}}, !dbg [[G2R2:!.*]]
21 // CHECK-NEXT: store i32 %0, ptr %arrayinit.element1{{.*}}, !dbg [[G2R1]]
22 int B[] = { 1, 2, g };
23
24 // CHECK: call void @llvm.memset{{.*}}%big{{.*}} !dbg [[G3R1:!.*]]
25 // CHECK-NEXT: %1 = getelementptr {{.*}}, ptr %big, {{.*}} 0, {{.*}} 0, !dbg [[big_LINE:!.*]]
26 // CHECK-NEXT: store i8 97, ptr %1{{.*}}, !dbg [[G3R1]]
27 // CHECK-NEXT: %2 = getelementptr {{.*}}, ptr %big, {{.*}} 0, {{.*}} 1, !dbg [[big_LINE]]
28 // CHECK-NEXT: store i8 98, ptr %2{{.*}}, !dbg [[G3R1]]
29 // CHECK-NEXT: %3 = getelementptr {{.*}}, ptr %big, {{.*}} 0, {{.*}} 2, !dbg [[big_LINE]]
30 // CHECK-NEXT: store i8 99, ptr %3{{.*}}, !dbg [[G3R1]]
31 // CHECK-NEXT: %4 = getelementptr {{.*}}, ptr %big, {{.*}} 0, {{.*}} 3, !dbg [[big_LINE]]
32 // CHECK: store i8 100, ptr %4{{.*}} !dbg [[G3R1]]
33 char big[65536] = { 'a', 'b', 'c', 'd' };
34
35 // CHECK: call void @llvm.memset{{.*}}%arr{{.*}}, !dbg [[G4R1:!.*]]
36 char arr[] = { 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, };
37
38 // CHECK: store i8 {{.*}}, ptr %uninit{{.*}}, !dbg [[G5R1:!.*]], !annotation
39 char uninit; // -ftrivial-auto-var-init=pattern
40
41 // CHECK: ret{{.*}}, !dbg [[RET:!.*]]
42 }
43
44 // CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
45 // CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
46 // CHECK: [[B_LINE]] = !DILocation(line: 22, scope: ![[#]])
47 // CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
48 // CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
49 // CHECK: [[big_LINE]] = !DILocation(line: 33, scope: ![[#]])
50 // CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
51 // CHECK: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1)
52 // CHECK: [[RET]] = !DILocation({{.*}}, atomGroup: 6, atomRank: 1)