Skip to content

Commit ed4d8c5

Browse files
committed
Add tests with the argument passed in memory and union types with pointer members.
1 parent bc296d9 commit ed4d8c5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

clang/test/CodeGen/transparent-union-type.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ void ftest0(tu_c_t uc) { }
5252
// CHECK-NEXT: ret void
5353
void ftest1(tu_s_t uc) { }
5454

55+
// CHECK-LABEL: define{{.*}} void @ftest1b(
56+
// CHECK-SAME: ptr nocapture noundef readnone [[UC:%.*]]) local_unnamed_addr #[[ATTR0]] {
57+
// CHECK-NEXT: [[ENTRY:.*:]]
58+
// CHECK-NEXT: ret void
59+
//
60+
void ftest1b(tu_s_t *uc) { }
61+
5562
// CHECK-LABEL: define{{.*}} void @ftest2(
5663
// CHECK-SAME: i16 noundef zeroext [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
5764
// CHECK-NEXT: [[ENTRY:.*:]]
@@ -79,3 +86,23 @@ typedef union etest {
7986
// CHECK-NEXT: [[ENTRY:.*:]]
8087
// CHECK-NEXT: ret void
8188
void ftest4(etest_t a) {}
89+
90+
typedef union tu_ptr {
91+
signed char *a;
92+
unsigned short *b;
93+
int *c;
94+
} tu_ptr_t __attribute__((transparent_union));
95+
96+
// CHECK-LABEL: define{{.*}} void @ftest5(
97+
// CHECK-SAME: ptr nocapture readnone [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
98+
// CHECK-NEXT: [[ENTRY:.*:]]
99+
// CHECK-NEXT: ret void
100+
//
101+
void ftest5(tu_ptr_t uc) { }
102+
103+
// CHECK-LABEL: define{{.*}} void @ftest6(
104+
// CHECK-SAME: ptr nocapture noundef readnone [[UC:%.*]]) local_unnamed_addr #[[ATTR0]] {
105+
// CHECK-NEXT: [[ENTRY:.*:]]
106+
// CHECK-NEXT: ret void
107+
//
108+
void ftest6(tu_ptr_t *uc) { }

0 commit comments

Comments
 (0)