From 71d5a2540a98c81f5bcaeb48805e0e2881f530ef Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 16 Apr 2017 16:01:22 +0000 Subject: Vendor import of llvm trunk r300422: https://llvm.org/svn/llvm-project/llvm/trunk@300422 --- lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp') diff --git a/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp b/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp index adf904ee0269..76a2ff3f9803 100644 --- a/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp +++ b/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp @@ -84,7 +84,7 @@ static void FindUses(Value *V, Function &F, // - Call with fewer arguments than needed: arguments are filled in with undef // - Return value is not needed: drop it // - Return value needed but not present: supply an undef -// +// // For now, return nullptr without creating a wrapper if the wrapper cannot // be generated due to incompatible types. static Function *CreateWrapper(Function *F, FunctionType *Ty) { @@ -148,6 +148,11 @@ bool FixFunctionBitcasts::runOnModule(Module &M) { if (!Ty) continue; + // Wasm varargs are not ABI-compatible with non-varargs. Just ignore + // such casts for now. + if (Ty->isVarArg() || F->isVarArg()) + continue; + auto Pair = Wrappers.insert(std::make_pair(std::make_pair(F, Ty), nullptr)); if (Pair.second) Pair.first->second = CreateWrapper(F, Ty); -- cgit v1.2.3