From 5292d17ec878251a23f90d9abddc676461501388 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 6 Nov 2018 00:31:02 +0000 Subject: Revert "[WebAssembly] Fixup `main` signature by default" This reverts rL345880. It caused some test failures on the webassembly waterfall. e.g. binaryen2.test_mainenv fails due the fact that `envp` ends up being undef rather than 0. Differential Revision: https://reviews.llvm.org/D54117 llvm-svn: 346187 --- llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp') diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp index dffc4d1..0644f12 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp @@ -36,6 +36,11 @@ using namespace llvm; #define DEBUG_TYPE "wasm-fix-function-bitcasts" +static cl::opt + TemporaryWorkarounds("wasm-temporary-workarounds", + cl::desc("Apply certain temporary workarounds"), + cl::init(true), cl::Hidden); + namespace { class FixFunctionBitcasts final : public ModulePass { StringRef getPassName() const override { @@ -236,7 +241,7 @@ bool FixFunctionBitcasts::runOnModule(Module &M) { // "int main(int argc, char *argv[])", create an artificial call with it // bitcasted to that type so that we generate a wrapper for it, so that // the C runtime can call it. - if (!F.isDeclaration() && F.getName() == "main") { + if (!TemporaryWorkarounds && !F.isDeclaration() && F.getName() == "main") { Main = &F; LLVMContext &C = M.getContext(); Type *MainArgTys[] = {Type::getInt32Ty(C), -- cgit v1.1