From a99b717f527fe7e37bf7a0b3fb612b7312d5c656 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 20 Jan 2017 20:50:29 +0000 Subject: [WebAssembly] Don't create bitcast-wrappers for varargs. WebAssembly varargs functions use a significantly different ABI than non-varargs functions, and the current code in WebAssemblyFixFunctionBitcasts doesn't handle that difference. For now, just avoid creating wrapper functions in the presence of varargs. llvm-svn: 292645 --- llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp | 5 +++++ 1 file changed, 5 insertions(+) (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 adf904ee026..cdbd9ea4b09 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp @@ -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