diff options
| author | Dan Gohman <dan433584@gmail.com> | 2019-01-29 10:53:42 +0000 |
|---|---|---|
| committer | Dan Gohman <dan433584@gmail.com> | 2019-01-29 10:53:42 +0000 |
| commit | 4684f824d4c143d483e31fa859a9948497f19c02 (patch) | |
| tree | 496d95d9176ac5db938574b5e9f20934b2e6162e /llvm/test/CodeGen/WebAssembly/main-declaration.ll | |
| parent | 2cdb2bd82b78503b38f8505644269b27271e5911 (diff) | |
| download | bcm5719-llvm-4684f824d4c143d483e31fa859a9948497f19c02.tar.gz bcm5719-llvm-4684f824d4c143d483e31fa859a9948497f19c02.zip | |
[WebAssembly] Re-enable main-function signature rewriting
Re-enable the code to rewrite main-function signatures into
"int main(int argc, char *argv[])", but limited to only handling
the case of "int main(void)", so that it doesn't silently strip
an argument in the "int main(int argc, char *argv[], char *envp[])"
case.
This allows main to be called by C startup code, since WebAssembly
requires caller and callee signatures to match, so it can't rely
on passing main a different number of arguments than it expects.
Differential Revision: https://reviews.llvm.org/D57323
llvm-svn: 352479
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/main-declaration.ll')
| -rw-r--r-- | llvm/test/CodeGen/WebAssembly/main-declaration.ll | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/main-declaration.ll b/llvm/test/CodeGen/WebAssembly/main-declaration.ll index f9d68db2bae..544f5588c50 100644 --- a/llvm/test/CodeGen/WebAssembly/main-declaration.ll +++ b/llvm/test/CodeGen/WebAssembly/main-declaration.ll @@ -1,20 +1,18 @@ -; RUN: llc < %s -asm-verbose=false -wasm-temporary-workarounds=false | FileCheck %s +; RUN: llc < %s -asm-verbose=false | FileCheck %s ; Test main functions with alternate signatures. target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" -declare void @main() +declare i32 @main() -define void @foo() { - call void @main() - ret void +define i32 @foo() { + %t = call i32 @main() + ret i32 %t } -; CHECK-NOT: __original_main ; CHECK-LABEL: foo: -; CHECK-NEXT: .functype foo () -> () -; CHECK-NEXT: call main@FUNCTION +; CHECK-NEXT: .functype foo () -> (i32) +; CHECK-NEXT: call __original_main@FUNCTION ; CHECK-NEXT: end_function -; CHECK-NOT: __original_main |

