7
7
8
8
// For LLVM IR checks, the structs are defined before the variables, so these
9
9
// checks are at the top.
10
+ // CIR-DAG: !ty_IncompleteS = !cir.record<struct "IncompleteS" incomplete>
11
+ // CIR-DAG: !ty_CompleteS = !cir.record<struct "CompleteS" {!s32i, !s8i}>
12
+ // CIR-DAG: !ty_OuterS = !cir.record<struct "OuterS" {!ty_InnerS, !s32i}>
13
+ // CIR-DAG: !ty_InnerS = !cir.record<struct "InnerS" {!s32i, !s8i}>
14
+ // CIR-DAG: !ty_PackedS = !cir.record<struct "PackedS" packed {!s32i, !s8i}>
15
+ // CIR-DAG: !ty_PackedAndPaddedS = !cir.record<struct "PackedAndPaddedS" packed padded {!s32i, !s8i, !u8i}>
16
+
10
17
// LLVM: %struct.CompleteS = type { i32, i8 }
11
18
// LLVM: %struct.OuterS = type { %struct.InnerS, i32 }
12
19
// LLVM: %struct.InnerS = type { i32, i8 }
13
20
// LLVM: %struct.PackedS = type <{ i32, i8 }>
14
21
// LLVM: %struct.PackedAndPaddedS = type <{ i32, i8, i8 }>
22
+
15
23
// OGCG: %struct.CompleteS = type { i32, i8 }
16
24
// OGCG: %struct.OuterS = type { %struct.InnerS, i32 }
17
25
// OGCG: %struct.InnerS = type { i32, i8 }
20
28
21
29
struct IncompleteS * p ;
22
30
23
- // CIR: cir.global external @p = #cir.ptr<null> : !cir.ptr<!cir.record<struct
24
- // CIR-SAME: "IncompleteS" incomplete>>
31
+ // CIR: cir.global external @p = #cir.ptr<null> : !cir.ptr<!ty_IncompleteS>
25
32
// LLVM: @p = dso_local global ptr null
26
33
// OGCG: @p = global ptr null, align 8
27
34
@@ -30,8 +37,7 @@ struct CompleteS {
30
37
char b ;
31
38
} cs ;
32
39
33
- // CIR: cir.global external @cs = #cir.zero : !cir.record<struct
34
- // CIR-SAME: "CompleteS" {!s32i, !s8i}>
40
+ // CIR: cir.global external @cs = #cir.zero : !ty_CompleteS
35
41
// LLVM: @cs = dso_local global %struct.CompleteS zeroinitializer
36
42
// OGCG: @cs = global %struct.CompleteS zeroinitializer, align 4
37
43
@@ -47,8 +53,7 @@ struct OuterS {
47
53
48
54
struct OuterS os ;
49
55
50
- // CIR: cir.global external @os = #cir.zero : !cir.record<struct
51
- // CIR-SAME: "OuterS" {!cir.record<struct "InnerS" {!s32i, !s8i}>, !s32i}>
56
+ // CIR: cir.global external @os = #cir.zero : !ty_OuterS
52
57
// LLVM: @os = dso_local global %struct.OuterS zeroinitializer
53
58
// OGCG: @os = global %struct.OuterS zeroinitializer, align 4
54
59
@@ -60,8 +65,7 @@ struct PackedS {
60
65
char a1 ;
61
66
} ps ;
62
67
63
- // CIR: cir.global external @ps = #cir.zero : !cir.record<struct "PackedS"
64
- // CIR-SAME: packed {!s32i, !s8i}>
68
+ // CIR: cir.global external @ps = #cir.zero : !ty_PackedS
65
69
// LLVM: @ps = dso_local global %struct.PackedS zeroinitializer
66
70
// OGCG: @ps = global %struct.PackedS zeroinitializer, align 1
67
71
@@ -70,8 +74,7 @@ struct PackedAndPaddedS {
70
74
char b1 ;
71
75
} __attribute__((aligned (2 ))) pps ;
72
76
73
- // CIR: cir.global external @pps = #cir.zero : !cir.record<struct
74
- // CIR-SAME: "PackedAndPaddedS" packed padded {!s32i, !s8i, !u8i}>
77
+ // CIR: cir.global external @pps = #cir.zero : !ty_PackedAndPaddedS
75
78
// LLVM: @pps = dso_local global %struct.PackedAndPaddedS zeroinitializer
76
79
// OGCG: @pps = global %struct.PackedAndPaddedS zeroinitializer, align 2
77
80
@@ -82,9 +85,7 @@ void f(void) {
82
85
}
83
86
84
87
// CIR: cir.func @f()
85
- // CIR-NEXT: cir.alloca !cir.ptr<!cir.record<struct "IncompleteS" incomplete>>,
86
- // CIR-SAME: !cir.ptr<!cir.ptr<!cir.record<struct
87
- // CIR-SAME: "IncompleteS" incomplete>>>, ["p"]
88
+ // CIR-NEXT: cir.alloca !cir.ptr<!ty_IncompleteS>, !cir.ptr<!cir.ptr<!ty_IncompleteS>>, ["p"] {alignment = 8 : i64}
88
89
// CIR-NEXT: cir.return
89
90
90
91
// LLVM: define void @f()
@@ -101,9 +102,7 @@ void f2(void) {
101
102
}
102
103
103
104
// CIR: cir.func @f2()
104
- // CIR-NEXT: cir.alloca !cir.record<struct "CompleteS" {!s32i, !s8i}>,
105
- // CIR-SAME: !cir.ptr<!cir.record<struct "CompleteS" {!s32i, !s8i}>>,
106
- // CIR-SAME: ["s"] {alignment = 4 : i64}
105
+ // CIR-NEXT: cir.alloca !ty_CompleteS, !cir.ptr<!ty_CompleteS>, ["s"] {alignment = 4 : i64}
107
106
// CIR-NEXT: cir.return
108
107
109
108
// LLVM: define void @f2()
0 commit comments