Skip to content

Commit eba39cf

Browse files
committed
[Concurrency] Corrected ordering of indirect results.
Previously, the indirect results were claimed from the explosion after the arguments were claimed. That failed to match the order in which arguments actually appear in the explosion. Here the order is reversed.
1 parent d5d65b0 commit eba39cf

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,14 +1974,6 @@ class AsyncCallEmission final : public CallEmission {
19741974
llArgs.add(selfValue);
19751975
}
19761976
auto layout = getAsyncContextLayout();
1977-
for (unsigned index = 0, count = layout.getArgumentCount(); index < count;
1978-
++index) {
1979-
auto fieldLayout = layout.getArgumentLayout(index);
1980-
Address fieldAddr =
1981-
fieldLayout.project(IGF, context, /*offsets*/ llvm::None);
1982-
auto &ti = cast<LoadableTypeInfo>(fieldLayout.getType());
1983-
ti.initialize(IGF, llArgs, fieldAddr, isOutlined);
1984-
}
19851977
for (unsigned index = 0, count = layout.getIndirectReturnCount();
19861978
index < count; ++index) {
19871979
auto fieldLayout = layout.getIndirectReturnLayout(index);
@@ -1990,6 +1982,14 @@ class AsyncCallEmission final : public CallEmission {
19901982
cast<LoadableTypeInfo>(fieldLayout.getType())
19911983
.initialize(IGF, llArgs, fieldAddr, isOutlined);
19921984
}
1985+
for (unsigned index = 0, count = layout.getArgumentCount(); index < count;
1986+
++index) {
1987+
auto fieldLayout = layout.getArgumentLayout(index);
1988+
Address fieldAddr =
1989+
fieldLayout.project(IGF, context, /*offsets*/ llvm::None);
1990+
auto &ti = cast<LoadableTypeInfo>(fieldLayout.getType());
1991+
ti.initialize(IGF, llArgs, fieldAddr, isOutlined);
1992+
}
19931993
if (layout.hasBindings()) {
19941994
auto bindingLayout = layout.getBindingsLayout();
19951995
auto bindingsAddr = bindingLayout.project(IGF, context, /*offsets*/ None);

test/IRGen/async/run-call-generic-to-generic.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>
3535
%out_addr = alloc_stack $Int64
3636

3737
%genericToGeneric = function_ref @genericToGeneric : $@async @convention(thin) <T> (@in_guaranteed T) -> @out T
38-
%result1 = apply %genericToGeneric<Int64>(%int_addr, %out_addr) : $@async @convention(thin) <T> (@in_guaranteed T) -> @out T
38+
%result1 = apply %genericToGeneric<Int64>(%out_addr, %int_addr) : $@async @convention(thin) <T> (@in_guaranteed T) -> @out T
3939

4040
%print_int = function_ref @printInt64 : $@convention(thin) (Int64) -> ()
4141
%out = load %out_addr : $*Int64

0 commit comments

Comments
 (0)