@@ -2530,7 +2530,9 @@ class AsyncCallEmission final : public CallEmission {
25302530 getCallee ().getFunctionPointer ().getKind ());
25312531
25322532 return FunctionPointer::createForAsyncCall (
2533- calleeFunction, codeAuthInfo, awaitSig, awaitEntrySig.getType ());
2533+ IGF.Builder .CreateBitCast (calleeFunction,
2534+ awaitEntrySig.getType ()->getPointerTo ()),
2535+ codeAuthInfo, awaitSig, awaitEntrySig.getType ());
25342536 }
25352537
25362538 SILType getParameterType (unsigned index) override {
@@ -5355,6 +5357,12 @@ llvm::FunctionType *FunctionPointer::getFunctionType() const {
53555357 return cast<llvm::Function>(SecondaryValue)->getFunctionType ();
53565358 }
53575359
5360+ if (awaitSignature) {
5361+ assert (llvm::cast<llvm::PointerType>(Value->getType ())
5362+ ->isOpaqueOrPointeeTypeMatches (awaitSignature));
5363+ return cast<llvm::FunctionType>(awaitSignature);
5364+ }
5365+
53585366 // Read the function type off the global or else from the Signature.
53595367 if (auto *constant = dyn_cast<llvm::Constant>(Value)) {
53605368 auto *gv = dyn_cast<llvm::GlobalValue>(Value);
@@ -5377,12 +5385,6 @@ llvm::FunctionType *FunctionPointer::getFunctionType() const {
53775385 return cast<llvm::FunctionType>(gv->getValueType ());
53785386 }
53795387
5380- if (awaitSignature) {
5381- assert (llvm::cast<llvm::PointerType>(Value->getType ())
5382- ->isOpaqueOrPointeeTypeMatches (awaitSignature));
5383- return cast<llvm::FunctionType>(awaitSignature);
5384- }
5385-
53865388 assert (llvm::cast<llvm::PointerType>(Value->getType ())
53875389 ->isOpaqueOrPointeeTypeMatches (Sig.getType ()));
53885390 return Sig.getType ();
0 commit comments