summaryrefslogtreecommitdiff
path: root/test/CodeGenCoroutines
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-06-03 00:22:18 +0000
committerEric Fiselier <eric@efcs.ca>2017-06-03 00:22:18 +0000
commit98cf823022d1d71065c71e9338226ebf8bfa36ba (patch)
treef8cf7081b976ff1f61da87c08829c08c46297f11 /test/CodeGenCoroutines
parent36a7841dc7f049d1ddd6848c784eedbd1754bff2 (diff)
[coroutines] Fix rebuilding of dependent coroutine parameters
Summary: We were not handling correctly rebuilding of parameter and were not creating copies for them. Now we will always rebuild parameter moves in TreeTransform's TransformCoroutineBodyStmt. Reviewers: rsmith, GorNishanov Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33797 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCoroutines')
-rw-r--r--test/CodeGenCoroutines/coro-params.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/CodeGenCoroutines/coro-params.cpp b/test/CodeGenCoroutines/coro-params.cpp
index c88e503a65..540f84585c 100644
--- a/test/CodeGenCoroutines/coro-params.cpp
+++ b/test/CodeGenCoroutines/coro-params.cpp
@@ -93,3 +93,37 @@ void f(int val, MoveOnly moParam, MoveAndCopy mcParam) {
// CHECK-NEXT: call void @_ZN8MoveOnlyD1Ev(%struct.MoveOnly* %[[MoCopy]]
// CHECK-NEXT: call i8* @llvm.coro.free(
}
+
+// CHECK-LABEL: void @_Z16dependent_paramsI1A1BEvT_T0_S3_(%struct.A* %x, %struct.B*, %struct.B* %y)
+template <typename T, typename U>
+void dependent_params(T x, U, U y) {
+ // CHECK: %[[x_copy:.+]] = alloca %struct.A
+ // CHECK-NEXT: %[[unnamed_copy:.+]] = alloca %struct.B
+ // CHECK-NEXT: %[[y_copy:.+]] = alloca %struct.B
+
+ // CHECK: call i8* @llvm.coro.begin
+ // CHECK-NEXT: call void @_ZN1AC1EOS_(%struct.A* %[[x_copy]], %struct.A* dereferenceable(512) %x)
+ // CHECK-NEXT: call void @_ZN1BC1EOS_(%struct.B* %[[unnamed_copy]], %struct.B* dereferenceable(512) %0)
+ // CHECK-NEXT: call void @_ZN1BC1EOS_(%struct.B* %[[y_copy]], %struct.B* dereferenceable(512) %y)
+ // CHECK-NEXT: invoke void @_ZNSt12experimental16coroutine_traitsIJv1A1BS2_EE12promise_typeC1Ev(
+
+ co_return;
+}
+
+struct A {
+ int WontFitIntoRegisterForSure[128];
+ A();
+ A(A&&) noexcept;
+ ~A();
+};
+
+struct B {
+ int WontFitIntoRegisterForSure[128];
+ B();
+ B(B&&) noexcept;
+ ~B();
+};
+
+void call_dependent_params() {
+ dependent_params(A{}, B{}, B{});
+}