diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2018-03-29 17:56:24 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2018-03-29 17:56:24 +0000 |
commit | 673af7a6881de2b63cc6cda95464d555abb1b404 (patch) | |
tree | 01e1b7e88459fbd1e73af922c46a2880c5410e85 /clang/test/CodeGen/ppc64-align-struct.c | |
parent | f4b6dcf6af9d1ef38f60f112c8ccbf2521e07e88 (diff) | |
download | bcm5719-llvm-673af7a6881de2b63cc6cda95464d555abb1b404.tar.gz bcm5719-llvm-673af7a6881de2b63cc6cda95464d555abb1b404.zip |
Generalize NRVO to cover C structs.
This commit generalizes NRVO to cover C structs (both trivial and
non-trivial structs).
rdar://problem/33599681
Differential Revision: https://reviews.llvm.org/D44968
llvm-svn: 328809
Diffstat (limited to 'clang/test/CodeGen/ppc64-align-struct.c')
-rw-r--r-- | clang/test/CodeGen/ppc64-align-struct.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/clang/test/CodeGen/ppc64-align-struct.c b/clang/test/CodeGen/ppc64-align-struct.c index 3cf3e0475b3..5e2dc8b2eb8 100644 --- a/clang/test/CodeGen/ppc64-align-struct.c +++ b/clang/test/CodeGen/ppc64-align-struct.c @@ -48,13 +48,12 @@ void test7 (int x, struct test7 y) { } -// CHECK-LABEL: define void @test1va(%struct.test1* noalias sret %agg.result, i32 signext %x, ...) -// CHECK: %y = alloca %struct.test1, align 4 +// CHECK: define void @test1va(%struct.test1* noalias sret %[[AGG_RESULT:.*]], i32 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.test1* -// CHECK: [[DEST:%.*]] = bitcast %struct.test1* %y to i8* +// CHECK: [[DEST:%.*]] = bitcast %struct.test1* %[[AGG_RESULT]] to i8* // CHECK: [[SRC:%.*]] = bitcast %struct.test1* [[T0]] to i8* // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[DEST]], i8* align 8 [[SRC]], i64 8, i1 false) struct test1 test1va (int x, ...) @@ -67,8 +66,7 @@ struct test1 test1va (int x, ...) return y; } -// CHECK-LABEL: define void @test2va(%struct.test2* noalias sret %agg.result, i32 signext %x, ...) -// CHECK: %y = alloca %struct.test2, align 16 +// CHECK: define void @test2va(%struct.test2* noalias sret %[[AGG_RESULT:.*]], i32 signext %x, ...) // CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap // CHECK: %[[TMP0:[^ ]+]] = ptrtoint i8* %[[CUR]] to i64 // CHECK: %[[TMP1:[^ ]+]] = add i64 %[[TMP0]], 15 @@ -77,7 +75,7 @@ struct test1 test1va (int x, ...) // CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[ALIGN]], i64 16 // CHECK: store i8* %[[NEXT]], i8** %ap // CHECK: [[T0:%.*]] = bitcast i8* %[[ALIGN]] to %struct.test2* -// CHECK: [[DEST:%.*]] = bitcast %struct.test2* %y to i8* +// CHECK: [[DEST:%.*]] = bitcast %struct.test2* %[[AGG_RESULT]] to i8* // CHECK: [[SRC:%.*]] = bitcast %struct.test2* [[T0]] to i8* // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 [[DEST]], i8* align 16 [[SRC]], i64 16, i1 false) struct test2 test2va (int x, ...) @@ -90,8 +88,7 @@ struct test2 test2va (int x, ...) return y; } -// CHECK-LABEL: define void @test3va(%struct.test3* noalias sret %agg.result, i32 signext %x, ...) -// CHECK: %y = alloca %struct.test3, align 32 +// CHECK: define void @test3va(%struct.test3* noalias sret %[[AGG_RESULT:.*]], i32 signext %x, ...) // CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap // CHECK: %[[TMP0:[^ ]+]] = ptrtoint i8* %[[CUR]] to i64 // CHECK: %[[TMP1:[^ ]+]] = add i64 %[[TMP0]], 15 @@ -100,7 +97,7 @@ struct test2 test2va (int x, ...) // CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[ALIGN]], i64 32 // CHECK: store i8* %[[NEXT]], i8** %ap // CHECK: [[T0:%.*]] = bitcast i8* %[[ALIGN]] to %struct.test3* -// CHECK: [[DEST:%.*]] = bitcast %struct.test3* %y to i8* +// CHECK: [[DEST:%.*]] = bitcast %struct.test3* %[[AGG_RESULT]] to i8* // CHECK: [[SRC:%.*]] = bitcast %struct.test3* [[T0]] to i8* // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 [[DEST]], i8* align 16 [[SRC]], i64 32, i1 false) struct test3 test3va (int x, ...) @@ -113,13 +110,12 @@ struct test3 test3va (int x, ...) return y; } -// CHECK-LABEL: define void @test4va(%struct.test4* noalias sret %agg.result, i32 signext %x, ...) -// CHECK: %y = alloca %struct.test4, align 4 +// CHECK: define void @test4va(%struct.test4* noalias sret %[[AGG_RESULT:.*]], i32 signext %x, ...) // CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap // CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 16 // CHECK: store i8* %[[NEXT]], i8** %ap // CHECK: [[T0:%.*]] = bitcast i8* %[[CUR]] to %struct.test4* -// CHECK: [[DEST:%.*]] = bitcast %struct.test4* %y to i8* +// CHECK: [[DEST:%.*]] = bitcast %struct.test4* %[[AGG_RESULT]] to i8* // CHECK: [[SRC:%.*]] = bitcast %struct.test4* [[T0]] to i8* // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[DEST]], i8* align 8 [[SRC]], i64 12, i1 false) struct test4 test4va (int x, ...) @@ -132,13 +128,12 @@ struct test4 test4va (int x, ...) return y; } -// CHECK-LABEL: define void @testva_longdouble(%struct.test_longdouble* noalias sret %agg.result, i32 signext %x, ...) -// CHECK: %y = alloca %struct.test_longdouble, align 16 +// CHECK: define void @testva_longdouble(%struct.test_longdouble* noalias sret %[[AGG_RESULT:.*]], i32 signext %x, ...) // CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap // CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 16 // CHECK: store i8* %[[NEXT]], i8** %ap // CHECK: [[T0:%.*]] = bitcast i8* %[[CUR]] to %struct.test_longdouble* -// CHECK: [[DEST:%.*]] = bitcast %struct.test_longdouble* %y to i8* +// CHECK: [[DEST:%.*]] = bitcast %struct.test_longdouble* %[[AGG_RESULT]] to i8* // CHECK: [[SRC:%.*]] = bitcast %struct.test_longdouble* [[T0]] to i8* // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 [[DEST]], i8* align 8 [[SRC]], i64 16, i1 false) struct test_longdouble { long double x; }; @@ -152,8 +147,7 @@ struct test_longdouble testva_longdouble (int x, ...) return y; } -// CHECK-LABEL: define void @testva_vector(%struct.test_vector* noalias sret %agg.result, i32 signext %x, ...) -// CHECK: %y = alloca %struct.test_vector, align 16 +// CHECK: define void @testva_vector(%struct.test_vector* noalias sret %[[AGG_RESULT:.*]], i32 signext %x, ...) // CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap // CHECK: %[[TMP0:[^ ]+]] = ptrtoint i8* %[[CUR]] to i64 // CHECK: %[[TMP1:[^ ]+]] = add i64 %[[TMP0]], 15 @@ -162,7 +156,7 @@ struct test_longdouble testva_longdouble (int x, ...) // CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[ALIGN]], i64 16 // CHECK: store i8* %[[NEXT]], i8** %ap // CHECK: [[T0:%.*]] = bitcast i8* %[[ALIGN]] to %struct.test_vector* -// CHECK: [[DEST:%.*]] = bitcast %struct.test_vector* %y to i8* +// CHECK: [[DEST:%.*]] = bitcast %struct.test_vector* %[[AGG_RESULT]] to i8* // CHECK: [[SRC:%.*]] = bitcast %struct.test_vector* [[T0]] to i8* // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 [[DEST]], i8* align 16 [[SRC]], i64 16, i1 false) struct test_vector { vector int x; }; |