From a4c2dd71c4148feb232996404412116e25f95e8f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 26 Feb 2020 06:12:09 +0000 Subject: [PATCH] [WASM] Skip thunk generation for throws func --- lib/IRGen/IRGenSIL.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/IRGen/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp index 50086ec069aa7..b458fee7dbc84 100644 --- a/lib/IRGen/IRGenSIL.cpp +++ b/lib/IRGen/IRGenSIL.cpp @@ -4756,10 +4756,9 @@ getLoweredFunctionPointer(IRGenSILFunction &IGF, SILValue v) { void IRGenSILFunction::visitThinToThickFunctionInst( swift::ThinToThickFunctionInst *i) { - - if (IGM.TargetInfo.OutputObjectFormat == llvm::Triple::Wasm) { - auto fn = getLoweredFunctionPointer(*this, i->getCallee()); - auto fnTy = i->getCallee()->getType().castTo(); + auto fn = getLoweredFunctionPointer(*this, i->getCallee()); + auto fnTy = i->getCallee()->getType().castTo(); + if (IGM.TargetInfo.OutputObjectFormat == llvm::Triple::Wasm && !fnTy->hasErrorResult()) { Optional staticFn; if (fn.isConstant()) staticFn = fn; auto thunkFn = getThinToThickForwarder(IGM, staticFn, fnTy);