diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-01-13 19:58:01 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-01-13 19:58:01 +0000 |
| commit | 050e163ae8b4bb6eb252b59e2f8f36e68ae9239d (patch) | |
| tree | 7376a0c71aad05d327e5b1dcbceb3311a10f9f29 /test/CodeGen/WebAssembly/userstack.ll | |
| parent | 8a6c1c25bce0267ee4072bd7b786b921e8a66a35 (diff) | |
Notes
Diffstat (limited to 'test/CodeGen/WebAssembly/userstack.ll')
| -rw-r--r-- | test/CodeGen/WebAssembly/userstack.ll | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/CodeGen/WebAssembly/userstack.ll b/test/CodeGen/WebAssembly/userstack.ll index 6e01e36cf9fa..cc50192b66db 100644 --- a/test/CodeGen/WebAssembly/userstack.ll +++ b/test/CodeGen/WebAssembly/userstack.ll @@ -2,7 +2,7 @@ ; RUN: llc < %s -asm-verbose=false -fast-isel | FileCheck %s -target datalayout = "e-p:32:32-i64:64-n32:64-S128" +target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: alloca32: @@ -72,6 +72,27 @@ define void @allocarray() { ret void } +define void @allocarray_inbounds() { + ; CHECK: i32.const [[L1:.+]]=, __stack_pointer + ; CHECK-NEXT: i32.load [[L1]]=, 0([[L1]]) + ; CHECK-NEXT: i32.const [[L2:.+]]=, 32 + ; CHECK-NEXT: i32.sub [[SP:.+]]=, [[L1]], [[L2]] + %r = alloca [5 x i32] + ; CHECK: i32.const $push[[L3:.+]]=, 1 + ; CHECK: i32.store {{.*}}=, 12([[SP]]), $pop[[L3]] + %p = getelementptr inbounds [5 x i32], [5 x i32]* %r, i32 0, i32 0 + store i32 1, i32* %p + ; This store should have both the GEP and the FI folded into it. + ; CHECK-NEXT: i32.store {{.*}}=, 16([[SP]]), $pop + %p2 = getelementptr inbounds [5 x i32], [5 x i32]* %r, i32 0, i32 1 + store i32 1, i32* %p2 + ; CHECK: i32.const [[L7:.+]]=, 32 + ; CHECK-NEXT: i32.add [[SP]]=, [[SP]], [[L7]] + ; CHECK-NEXT: i32.const [[L8:.+]]=, __stack_pointer + ; CHECK-NEXT: i32.store [[SP]]=, 0([[L7]]), [[SP]] + ret void +} + define void @dynamic_alloca(i32 %alloc) { ; TODO: Support frame pointers ;%r = alloca i32, i32 %alloc |
