aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-11-06 00:31:02 +0000
committerSam Clegg <sbc@chromium.org>2018-11-06 00:31:02 +0000
commit5292d17ec878251a23f90d9abddc676461501388 (patch)
treea104fa7c0038f78abef1f5676624f6fce5b7ba87 /llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
parent62d2f76a4542c3f0760426386d5b8e68d97af9c6 (diff)
downloadllvm-5292d17ec878251a23f90d9abddc676461501388.zip
llvm-5292d17ec878251a23f90d9abddc676461501388.tar.gz
llvm-5292d17ec878251a23f90d9abddc676461501388.tar.bz2
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
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp7
1 files changed, 6 insertions, 1 deletions
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<bool>
+ 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),