Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CodeGenCXX/cxx1y-initializer-aggregate.cpp @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
1 // RUN: %clang_cc1 -no-opaque-pointers -std=c++1y %s -triple x86_64-linux-gnu -emit-llvm -o - | FileCheck %s | 1 // RUN: %clang_cc1 -std=c++1y %s -triple x86_64-linux-gnu -emit-llvm -o - | FileCheck %s |
2 | 2 |
3 struct A { | 3 struct A { |
4 int n = 0; | 4 int n = 0; |
5 const char *p; | 5 const char *p; |
6 char k = p[n]; | 6 char k = p[n]; |
27 // CHECK: @[[STR_A:.*]] = {{.*}} [7 x i8] c"foobar\00" | 27 // CHECK: @[[STR_A:.*]] = {{.*}} [7 x i8] c"foobar\00" |
28 // CHECK: @a ={{.*}} global {{.*}} zeroinitializer | 28 // CHECK: @a ={{.*}} global {{.*}} zeroinitializer |
29 | 29 |
30 // @b has a constant initializer | 30 // @b has a constant initializer |
31 // CHECK: @[[STR_B:.*]] = {{.*}} [8 x i8] c"bazquux\00" | 31 // CHECK: @[[STR_B:.*]] = {{.*}} [8 x i8] c"bazquux\00" |
32 // CHECK: @b ={{.*}} global {{.*}} i32 4, {{.*}} @[[STR_B]], {{.*}} i8 117, i32 42, {{.*}} i8 9 | 32 // CHECK: @b ={{.*}} global {{.*}} i32 4, {{.*}} @[[STR_B]], i8 117, i32 42, {{.*}} i8 9 |
33 | 33 |
34 B x; | 34 B x; |
35 B y {}; | 35 B y {}; |
36 B z { 1 }; | 36 B z { 1 }; |
37 // CHECK: @z ={{.*}} global {{.*}} { i32 1 } | 37 // CHECK: @z ={{.*}} global {{.*}} { i32 1 } |
47 C n{}; | 47 C n{}; |
48 // CHECK: @n ={{.*}} global %union.C { %struct.anon { i64 -1 } }, align 8 | 48 // CHECK: @n ={{.*}} global %union.C { %struct.anon { i64 -1 } }, align 8 |
49 | 49 |
50 // Initialization of 'a': | 50 // Initialization of 'a': |
51 | 51 |
52 // CHECK: store i32 0, i32* getelementptr inbounds ({{.*}} @a, i32 0, i32 0) | 52 // CHECK: store i32 0, ptr @a |
53 // CHECK: store i8* {{.*}} @[[STR_A]]{{.*}}, i8** getelementptr inbounds ({{.*}} @a, i32 0, i32 1) | 53 // CHECK: store ptr @[[STR_A]], ptr getelementptr inbounds ({{.*}} @a, i32 0, i32 1) |
54 // CHECK: load i8*, i8** getelementptr inbounds ({{.*}} @a, i32 0, i32 1) | 54 // CHECK: load ptr, ptr getelementptr inbounds ({{.*}} @a, i32 0, i32 1) |
55 // CHECK: load i32, i32* getelementptr inbounds ({{.*}} @a, i32 0, i32 0) | 55 // CHECK: load i32, ptr @a |
56 // CHECK: getelementptr inbounds i8, i8* %{{.*}}, {{.*}} %{{.*}} | 56 // CHECK: getelementptr inbounds i8, ptr %{{.*}}, {{.*}} %{{.*}} |
57 // CHECK: store i8 %{{.*}}, i8* getelementptr inbounds ({{.*}} @a, i32 0, i32 2) | 57 // CHECK: store i8 %{{.*}}, ptr getelementptr inbounds ({{.*}} @a, i32 0, i32 2) |
58 // CHECK: call noundef i32 @_ZN1A1fEv({{.*}} @a) | 58 // CHECK: call noundef i32 @_ZN1A1fEv({{.*}} @a) |
59 // CHECK: store i32 %{{.*}}, i32* getelementptr inbounds ({{.*}}, {{.*}}* @a, i32 0, i32 3) | 59 // CHECK: store i32 %{{.*}}, ptr getelementptr inbounds ({{.*}}, ptr @a, i32 0, i32 3) |
60 // CHECK: store double 1.000000e+00, double* getelementptr inbounds ({{.*}} @a, i32 0, i32 4, i32 0) | 60 // CHECK: store double 1.000000e+00, ptr getelementptr inbounds ({{.*}} @a, i32 0, i32 4) |
61 | 61 |
62 // No dynamic initialization of 'b': | 62 // No dynamic initialization of 'b': |
63 | 63 |
64 // CHECK-NOT: @b | 64 // CHECK-NOT: @b |
65 | 65 |
66 // Initialization of 'c': | 66 // Initialization of 'c': |
67 | 67 |
68 // CHECK: store i32 1, i32* getelementptr inbounds ({{.*}} @c, i32 0, i32 0) | 68 // CHECK: store i32 1, ptr @c |
69 // CHECK: store i8* null, i8** getelementptr inbounds ({{.*}} @c, i32 0, i32 1) | 69 // CHECK: store ptr null, ptr getelementptr inbounds ({{.*}} @c, i32 0, i32 1) |
70 // CHECK-NOT: load | 70 // CHECK-NOT: load |
71 // CHECK: store i8 65, i8* getelementptr inbounds ({{.*}} @c, i32 0, i32 2) | 71 // CHECK: store i8 65, ptr getelementptr inbounds ({{.*}} @c, i32 0, i32 2) |
72 // CHECK: call noundef i32 @_Z1fv() | 72 // CHECK: call noundef i32 @_Z1fv() |
73 // CHECK: store i32 %{{.*}}, i32* getelementptr inbounds ({{.*}}, {{.*}}* @c, i32 0, i32 3) | 73 // CHECK: store i32 %{{.*}}, ptr getelementptr inbounds ({{.*}}, ptr @c, i32 0, i32 3) |
74 // CHECK-NOT: C1Ev | 74 // CHECK-NOT: C1Ev |
75 // CHECK: store i8 3, i8* {{.*}} @c, i32 0, i32 4) | 75 // CHECK: store i8 3, ptr {{.*}} @c, i32 0, i32 4) |
76 | 76 |
77 // CHECK: call void @_ZN1BC1Ev({{.*}} @x) | 77 // CHECK: call void @_ZN1BC1Ev({{.*}} @x) |
78 | 78 |
79 // CHECK: call noundef i32 @_ZN1B1fEv({{.*}} @y) | 79 // CHECK: call noundef i32 @_ZN1B1fEv({{.*}} @y) |
80 // CHECK: store i32 %{{.*}}, i32* getelementptr inbounds ({{.*}} @y, i32 0, i32 0) | 80 // CHECK: store i32 %{{.*}}, ptr @y |