Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit efe8743

Browse files
authored
Merge pull request #112 from alexcrichton/wasm-fix
[WebAssembly] Teach fast-isel to gracefully recover from illegal retu…
2 parents 599282d + b6c1a03 commit efe8743

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

lib/Target/WebAssembly/WebAssemblyFastISel.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,12 @@ bool WebAssemblyFastISel::fastLowerArguments() {
698698
for (auto const &Arg : F->args())
699699
MFI->addParam(getLegalType(getSimpleType(Arg.getType())));
700700

701-
if (!F->getReturnType()->isVoidTy())
702-
MFI->addResult(getLegalType(getSimpleType(F->getReturnType())));
701+
if (!F->getReturnType()->isVoidTy()) {
702+
MVT::SimpleValueType RetTy = getSimpleType(F->getReturnType());
703+
if (RetTy == MVT::INVALID_SIMPLE_VALUE_TYPE)
704+
return false;
705+
MFI->addResult(getLegalType(RetTy));
706+
}
703707

704708
return true;
705709
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; RUN: llc < %s -O0
2+
; PR36564
3+
4+
; Test that fast-isel properly copes with i24 arguments and return types.
5+
6+
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
7+
target triple = "wasm32-unknown-unknown-wasm"
8+
9+
define i24 @add(i24 %x, i24 %y) {
10+
%z = add i24 %x, %y
11+
ret i24 %z
12+
}
13+
14+
define i24 @return_zero() {
15+
ret i24 0
16+
}

0 commit comments

Comments
 (0)