summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2017-01-20 20:50:29 +0000
committerDan Gohman <dan433584@gmail.com>2017-01-20 20:50:29 +0000
commita99b717f527fe7e37bf7a0b3fb612b7312d5c656 (patch)
tree85eb776a1a955740e3501aa7a8bf03a251f16c3d /llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
parent0347c0b87419d3added9e3e39cfe36280d8ce78a (diff)
downloadbcm5719-llvm-a99b717f527fe7e37bf7a0b3fb612b7312d5c656.tar.gz
bcm5719-llvm-a99b717f527fe7e37bf7a0b3fb612b7312d5c656.zip
[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
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp5
1 files changed, 5 insertions, 0 deletions
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);
OpenPOWER on IntegriCloud