@@ -1952,6 +1952,12 @@ class AsyncCallEmission final : public CallEmission {
19521952 getCallee ().getSubstitutions ());
19531953 }
19541954
1955+ void saveValue (ElementLayout layout, Explosion &explosion, bool isOutlined) {
1956+ Address addr = layout.project (IGF, context, /* offsets*/ llvm::None);
1957+ auto &ti = cast<LoadableTypeInfo>(layout.getType ());
1958+ ti.initialize (IGF, explosion, addr, isOutlined);
1959+ }
1960+
19551961public:
19561962 AsyncCallEmission (IRGenFunction &IGF, llvm::Value *selfValue, Callee &&callee)
19571963 : CallEmission(IGF, selfValue, std::move(callee)) {
@@ -2000,18 +2006,12 @@ class AsyncCallEmission final : public CallEmission {
20002006 for (unsigned index = 0 , count = layout.getIndirectReturnCount ();
20012007 index < count; ++index) {
20022008 auto fieldLayout = layout.getIndirectReturnLayout (index);
2003- Address fieldAddr =
2004- fieldLayout.project (IGF, context, /* offsets*/ llvm::None);
2005- cast<LoadableTypeInfo>(fieldLayout.getType ())
2006- .initialize (IGF, llArgs, fieldAddr, isOutlined);
2009+ saveValue (fieldLayout, llArgs, isOutlined);
20072010 }
20082011 for (unsigned index = 0 , count = layout.getArgumentCount (); index < count;
20092012 ++index) {
20102013 auto fieldLayout = layout.getArgumentLayout (index);
2011- Address fieldAddr =
2012- fieldLayout.project (IGF, context, /* offsets*/ llvm::None);
2013- auto &ti = cast<LoadableTypeInfo>(fieldLayout.getType ());
2014- ti.initialize (IGF, llArgs, fieldAddr, isOutlined);
2014+ saveValue (fieldLayout, llArgs, isOutlined);
20152015 }
20162016 if (layout.hasBindings ()) {
20172017 auto bindingLayout = layout.getBindingsLayout ();
@@ -2020,10 +2020,7 @@ class AsyncCallEmission final : public CallEmission {
20202020 }
20212021 if (selfValue) {
20222022 auto fieldLayout = layout.getLocalContextLayout ();
2023- Address fieldAddr =
2024- fieldLayout.project (IGF, context, /* offsets*/ llvm::None);
2025- auto &ti = cast<LoadableTypeInfo>(fieldLayout.getType ());
2026- ti.initialize (IGF, llArgs, fieldAddr, isOutlined);
2023+ saveValue (fieldLayout, llArgs, isOutlined);
20272024 }
20282025 }
20292026 void emitCallToUnmappedExplosion (llvm::CallInst *call, Explosion &out) override {
0 commit comments