77
88// For LLVM IR checks, the structs are defined before the variables, so these
99// 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+
1017// LLVM: %struct.CompleteS = type { i32, i8 }
1118// LLVM: %struct.OuterS = type { %struct.InnerS, i32 }
1219// LLVM: %struct.InnerS = type { i32, i8 }
1320// LLVM: %struct.PackedS = type <{ i32, i8 }>
1421// LLVM: %struct.PackedAndPaddedS = type <{ i32, i8, i8 }>
22+
1523// OGCG: %struct.CompleteS = type { i32, i8 }
1624// OGCG: %struct.OuterS = type { %struct.InnerS, i32 }
1725// OGCG: %struct.InnerS = type { i32, i8 }
2028
2129struct IncompleteS * p ;
2230
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>
2532// LLVM: @p = dso_local global ptr null
2633// OGCG: @p = global ptr null, align 8
2734
@@ -30,8 +37,7 @@ struct CompleteS {
3037 char b ;
3138} cs ;
3239
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
3541// LLVM: @cs = dso_local global %struct.CompleteS zeroinitializer
3642// OGCG: @cs = global %struct.CompleteS zeroinitializer, align 4
3743
@@ -47,8 +53,7 @@ struct OuterS {
4753
4854struct OuterS os ;
4955
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
5257// LLVM: @os = dso_local global %struct.OuterS zeroinitializer
5358// OGCG: @os = global %struct.OuterS zeroinitializer, align 4
5459
@@ -60,8 +65,7 @@ struct PackedS {
6065 char a1 ;
6166} ps ;
6267
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
6569// LLVM: @ps = dso_local global %struct.PackedS zeroinitializer
6670// OGCG: @ps = global %struct.PackedS zeroinitializer, align 1
6771
@@ -70,8 +74,7 @@ struct PackedAndPaddedS {
7074 char b1 ;
7175} __attribute__((aligned (2 ))) pps ;
7276
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
7578// LLVM: @pps = dso_local global %struct.PackedAndPaddedS zeroinitializer
7679// OGCG: @pps = global %struct.PackedAndPaddedS zeroinitializer, align 2
7780
@@ -82,9 +85,7 @@ void f(void) {
8285}
8386
8487// 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}
8889// CIR-NEXT: cir.return
8990
9091// LLVM: define void @f()
@@ -101,9 +102,7 @@ void f2(void) {
101102}
102103
103104// 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}
107106// CIR-NEXT: cir.return
108107
109108// LLVM: define void @f2()
0 commit comments