diff --git a/clang/test/CodeGen/PowerPC/ppc64-align-struct.c b/clang/test/CodeGen/PowerPC/ppc64-align-struct.c --- a/clang/test/CodeGen/PowerPC/ppc64-align-struct.c +++ b/clang/test/CodeGen/PowerPC/ppc64-align-struct.c @@ -9,6 +9,7 @@ struct test5 { int x[17]; }; struct test6 { int x[17]; } __attribute__((aligned (16))); struct test7 { int x[17]; } __attribute__((aligned (32))); +struct test8 { char x; }; // CHECK: define{{.*}} void @test1(i32 noundef signext %x, i64 %y.coerce) void test1 (int x, struct test1 y) @@ -128,6 +129,25 @@ return y; } +// Error pattern will be fixed in https://reviews.llvm.org/D133338 +// CHECK: define{{.*}} void @test8va(%struct.test8* noalias sret(%struct.test8) align 1 %[[AGG_RESULT:.*]], i32 noundef signext %x, ...) +// CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap +// CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 8 +// CHECK: store i8* %[[NEXT]], i8** %ap +// CHECK: [[T0:%.*]] = bitcast i8* %[[CUR]] to %struct.test8* +// CHECK: [[DEST:%.*]] = bitcast %struct.test8* %[[AGG_RESULT]] to i8* +// CHECK: [[SRC:%.*]] = bitcast %struct.test8* [[T0]] to i8* +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 [[DEST]], i8* align 8 [[SRC]], i64 1, i1 false) +struct test8 test8va (int x, ...) +{ + struct test8 y; + va_list ap; + va_start(ap, x); + y = va_arg (ap, struct test8); + va_end(ap); + return y; +} + // CHECK: define{{.*}} void @testva_longdouble(%struct.test_longdouble* noalias sret(%struct.test_longdouble) align 16 %[[AGG_RESULT:.*]], i32 noundef signext %x, ...) // CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap // CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 16