summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2018-04-17 20:46:42 +0000
committerDan Gohman <dan433584@gmail.com>2018-04-17 20:46:42 +0000
commit4576dc06beca1889c8e5ab8fd12306f44a8e2828 (patch)
tree6c5bc8d075c931983f6722c84c174770d8da803b /llvm/lib/Target/WebAssembly
parent1ecb34f4ab983869eb3161d687f2994c6e0c69be (diff)
downloadbcm5719-llvm-4576dc06beca1889c8e5ab8fd12306f44a8e2828.tar.gz
bcm5719-llvm-4576dc06beca1889c8e5ab8fd12306f44a8e2828.zip
[WebAssembly] Teach fast-isel to gracefully recover from illegal return types.
Fixes PR36564. llvm-svn: 330215
Diffstat (limited to 'llvm/lib/Target/WebAssembly')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp8
1 files changed, 6 insertions, 2 deletions
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;
}
OpenPOWER on IntegriCloud