From 4576dc06beca1889c8e5ab8fd12306f44a8e2828 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 17 Apr 2018 20:46:42 +0000 Subject: [WebAssembly] Teach fast-isel to gracefully recover from illegal return types. Fixes PR36564. llvm-svn: 330215 --- llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Target') diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp index f3ee6e70822..c13dd7a48a7 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp @@ -703,8 +703,12 @@ bool WebAssemblyFastISel::fastLowerArguments() { for (auto const &Arg : F->args()) MFI->addParam(getLegalType(getSimpleType(Arg.getType()))); - if (!F->getReturnType()->isVoidTy()) - MFI->addResult(getLegalType(getSimpleType(F->getReturnType()))); + if (!F->getReturnType()->isVoidTy()) { + MVT::SimpleValueType RetTy = getSimpleType(F->getReturnType()); + if (RetTy == MVT::INVALID_SIMPLE_VALUE_TYPE) + return false; + MFI->addResult(getLegalType(RetTy)); + } return true; } -- cgit v1.2.3