diff options
| author | Derek Schuff <dschuff@google.com> | 2016-01-30 21:43:08 +0000 |
|---|---|---|
| committer | Derek Schuff <dschuff@google.com> | 2016-01-30 21:43:08 +0000 |
| commit | c97ba939d15c4d6dc371e9ccf7cd88d1e8c32768 (patch) | |
| tree | e30cf0c1eb14d7eb1eedca87029e0f21393ab611 /llvm/test | |
| parent | fbc89d21dd7c878d5238d90eafd597aff46f33e0 (diff) | |
| download | bcm5719-llvm-c97ba939d15c4d6dc371e9ccf7cd88d1e8c32768.tar.gz bcm5719-llvm-c97ba939d15c4d6dc371e9ccf7cd88d1e8c32768.zip | |
[WebAssembly] Fix uses of FrameIndex as store values
Previously the code assumed all uses of FI on loads and stores were as
addresses. This checks whether the use is the address or a value and
handles the latter case as it does for non-memory instructions.
llvm-svn: 259306
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/WebAssembly/userstack.ll | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/userstack.ll b/llvm/test/CodeGen/WebAssembly/userstack.ll index 4da1324260a..435e1dd0b84 100644 --- a/llvm/test/CodeGen/WebAssembly/userstack.ll +++ b/llvm/test/CodeGen/WebAssembly/userstack.ll @@ -78,9 +78,10 @@ define void @allocarray() { declare void @ext_func(i64* %ptr) ; CHECK-LABEL: non_mem_use -define void @non_mem_use() { - ; CHECK: i32.const [[L2:.+]]=, 16 +define void @non_mem_use(i8** %addr) { + ; CHECK: i32.const [[L2:.+]]=, 48 ; CHECK-NEXT: i32.sub [[SP:.+]]=, {{.+}}, [[L2]] + %buf = alloca [27 x i8], align 16 %r = alloca i64 %r2 = alloca i64 ; %r is at SP+8 @@ -91,6 +92,13 @@ define void @non_mem_use() { ; %r2 is at SP+0, no add needed ; CHECK-NEXT: call ext_func@FUNCTION, [[SP]] call void @ext_func(i64* %r2) + ; Use as a value, but in a store + ; %buf is at SP+16 + ; CHECK: i32.const [[OFF:.+]]=, 16 + ; CHECK-NEXT: i32.add [[VAL:.+]]=, [[SP]], [[OFF]] + ; CHECK-NEXT: i32.store {{.*}}=, 0($0), [[VAL]] + %gep = getelementptr inbounds [27 x i8], [27 x i8]* %buf, i32 0, i32 0 + store i8* %gep, i8** %addr ret void } @@ -151,4 +159,5 @@ define void @dynamic_static_alloca(i32 %alloc) { ; CHECK-NEXT: i32.store [[SP]]=, 0([[L4]]), [[SP]] ret void } -; TODO: test aligned alloc + +; TODO: test over-aligned alloca |

