Skip to content

Commit b8a5b62

Browse files
committed
[NFC] Cached the layout in AsyncCallEmission.
1 parent 6829b66 commit b8a5b62

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,11 +2061,15 @@ class AsyncCallEmission final : public CallEmission {
20612061
Size contextSize;
20622062
Address context;
20632063
llvm::Value *thickContext = nullptr;
2064+
Optional<AsyncContextLayout> asyncContextLayout;
20642065

20652066
AsyncContextLayout getAsyncContextLayout() {
2066-
return ::getAsyncContextLayout(IGF, getCallee().getOrigFunctionType(),
2067-
getCallee().getSubstFunctionType(),
2068-
getCallee().getSubstitutions());
2067+
if (!asyncContextLayout) {
2068+
asyncContextLayout.emplace(::getAsyncContextLayout(
2069+
IGF, getCallee().getOrigFunctionType(),
2070+
getCallee().getSubstFunctionType(), getCallee().getSubstitutions()));
2071+
}
2072+
return *asyncContextLayout;
20692073
}
20702074

20712075
void saveValue(ElementLayout layout, Explosion &explosion, bool isOutlined) {

0 commit comments

Comments
 (0)