@@ -1952,6 +1952,12 @@ class AsyncCallEmission final : public CallEmission {
1952
1952
getCallee ().getSubstitutions ());
1953
1953
}
1954
1954
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
+
1955
1961
public:
1956
1962
AsyncCallEmission (IRGenFunction &IGF, llvm::Value *selfValue, Callee &&callee)
1957
1963
: CallEmission(IGF, selfValue, std::move(callee)) {
@@ -2000,18 +2006,12 @@ class AsyncCallEmission final : public CallEmission {
2000
2006
for (unsigned index = 0 , count = layout.getIndirectReturnCount ();
2001
2007
index < count; ++index) {
2002
2008
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);
2007
2010
}
2008
2011
for (unsigned index = 0 , count = layout.getArgumentCount (); index < count;
2009
2012
++index) {
2010
2013
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);
2015
2015
}
2016
2016
if (layout.hasBindings ()) {
2017
2017
auto bindingLayout = layout.getBindingsLayout ();
@@ -2020,10 +2020,7 @@ class AsyncCallEmission final : public CallEmission {
2020
2020
}
2021
2021
if (selfValue) {
2022
2022
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);
2027
2024
}
2028
2025
}
2029
2026
void emitCallToUnmappedExplosion (llvm::CallInst *call, Explosion &out) override {
0 commit comments