From 0c5954195b706b13dbac96fab1d60492938da8db Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 18 Jan 2017 01:03:35 +0000 Subject: [PATCH] [WebAssembly] Update grow_memory's return type. The grow_memory instruction now returns the previous memory size. Add the return type to the clang intrinsic. llvm-svn: 292324 --- clang/include/clang/Basic/BuiltinsWebAssembly.def | 6 +++--- clang/test/CodeGen/builtins-wasm.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/include/clang/Basic/BuiltinsWebAssembly.def b/clang/include/clang/Basic/BuiltinsWebAssembly.def index 97b59a1fd86c..de56908be83c 100644 --- a/clang/include/clang/Basic/BuiltinsWebAssembly.def +++ b/clang/include/clang/Basic/BuiltinsWebAssembly.def @@ -16,9 +16,9 @@ // The format of this database matches clang/Basic/Builtins.def. -// Note that current_memory is not "c" (readnone) because it must be sequenced with -// respect to grow_memory calls. +// Note that current_memory is not "c" (readnone) because it must be sequenced +// with respect to grow_memory calls. BUILTIN(__builtin_wasm_current_memory, "z", "n") -BUILTIN(__builtin_wasm_grow_memory, "vz", "n") +BUILTIN(__builtin_wasm_grow_memory, "zz", "n") #undef BUILTIN diff --git a/clang/test/CodeGen/builtins-wasm.c b/clang/test/CodeGen/builtins-wasm.c index 135e32976b7d..0c0b87945d42 100644 --- a/clang/test/CodeGen/builtins-wasm.c +++ b/clang/test/CodeGen/builtins-wasm.c @@ -9,8 +9,8 @@ __SIZE_TYPE__ f1(void) { // WEBASSEMBLY64: call {{i.*}} @llvm.wasm.current.memory.i64() } -void f2(long delta) { - __builtin_wasm_grow_memory(delta); -// WEBASSEMBLY32: call void @llvm.wasm.grow.memory.i32(i32 %{{.*}}) -// WEBASSEMBLY64: call void @llvm.wasm.grow.memory.i64(i64 %{{.*}}) +__SIZE_TYPE__ f2(__SIZE_TYPE__ delta) { + return __builtin_wasm_grow_memory(delta); +// WEBASSEMBLY32: call i32 @llvm.wasm.grow.memory.i32(i32 %{{.*}}) +// WEBASSEMBLY64: call i64 @llvm.wasm.grow.memory.i64(i64 %{{.*}}) }