summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2016-01-20 04:21:16 +0000
committerDan Gohman <dan433584@gmail.com>2016-01-20 04:21:16 +0000
commit7e64917fd196e224e7552d6caeae133afd406681 (patch)
tree526c5f8a40750d683e1c7cbecdc9a2ad8f11498a /llvm/test
parent3f7c20747dd2babbf809be35217912d0f31895e4 (diff)
downloadbcm5719-llvm-7e64917fd196e224e7552d6caeae133afd406681.tar.gz
bcm5719-llvm-7e64917fd196e224e7552d6caeae133afd406681.zip
[WebAssembly] Don't stackify stores across instructions with side effects.
llvm-svn: 258285
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/WebAssembly/reg-stackify.ll17
-rw-r--r--llvm/test/CodeGen/WebAssembly/userstack.ll31
2 files changed, 36 insertions, 12 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
index 8a9d399b39f..3b700e94e2b 100644
--- a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
+++ b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
@@ -128,4 +128,21 @@ return:
ret void
}
+; Don't stackify stores effects across other instructions with side effects.
+
+; CHECK: side_effects:
+; CHECK: store
+; CHECK-NEXT: call
+; CHECK-NEXT: store
+; CHECK-NEXT: call
+declare void @evoke_side_effects()
+define hidden void @stackify_store_across_side_effects(double* nocapture %d) {
+entry:
+ store double 2.0, double* %d
+ call void @evoke_side_effects()
+ store double 2.0, double* %d
+ call void @evoke_side_effects()
+ ret void
+}
+
!0 = !{}
diff --git a/llvm/test/CodeGen/WebAssembly/userstack.ll b/llvm/test/CodeGen/WebAssembly/userstack.ll
index cc50192b66d..60158ee9fec 100644
--- a/llvm/test/CodeGen/WebAssembly/userstack.ll
+++ b/llvm/test/CodeGen/WebAssembly/userstack.ll
@@ -47,31 +47,37 @@ define void @alloca3264() {
}
; CHECK-LABEL: allocarray:
-; CHECK: .local i32, i32, i32, i32, i32, i32{{$}}
+; CHECK: .local i32, i32, i32, i32, i32{{$}}
define void @allocarray() {
- ; CHECK: i32.const [[L1:.+]]=, __stack_pointer
+ ; CHECK-NEXT: i32.const [[L1:.+]]=, __stack_pointer
; CHECK-NEXT: i32.load [[L1]]=, 0([[L1]])
- ; CHECK-NEXT: i32.const [[L2:.+]]=, 32
+ ; CHECK-NEXT: i32.const [[L2:.+]]=, 32{{$}}
; CHECK-NEXT: i32.sub [[SP:.+]]=, [[L1]], [[L2]]
+ ; CHECK-NEXT: i32.const [[L2]]=, __stack_pointer{{$}}
+ ; CHECK-NEXT: i32.store [[SP]]=, 0([[L2]]), [[SP]]
%r = alloca [5 x i32]
- ; CHECK: i32.const $push[[L3:.+]]=, 1
- ; CHECK: i32.store {{.*}}=, 12([[SP]]), $pop[[L3]]
+
+ ; CHECK-NEXT: i32.const $push[[L4:.+]]=, 4
+ ; CHECK-NEXT: i32.const [[L5:.+]]=, 12
+ ; CHECK-NEXT: i32.add [[L5]]=, [[SP]], [[L5]]
+ ; CHECK-NEXT: i32.add $push[[L6:.+]]=, [[L5]], $pop[[L4]]
+ ; CHECK-NEXT: i32.const $push[[L9:.+]]=, 1{{$}}
+ ; CHECK-NEXT: i32.store $push[[L10:.+]]=, 12([[SP]]), $pop[[L9]]{{$}}
+ ; CHECK-NEXT: i32.store $discard=, 0($pop3), $pop[[L10]]{{$}}
%p = getelementptr [5 x i32], [5 x i32]* %r, i32 0, i32 0
store i32 1, i32* %p
- ; CHECK: i32.const $push[[L4:.+]]=, 4
- ; CHECK: i32.const [[L5:.+]]=, 12
- ; CHECK: i32.add [[L5]]=, [[SP]], [[L5]]
- ; CHECK: i32.add $push[[L6:.+]]=, [[L5]], $pop[[L4]]
- ; CHECK: i32.store {{.*}}=, 0($pop[[L6]]), ${{.+}}
%p2 = getelementptr [5 x i32], [5 x i32]* %r, i32 0, i32 1
store i32 1, i32* %p2
- ; CHECK: i32.const [[L7:.+]]=, 32
+
+ ; CHECK-NEXT: 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]]
+ ; CHECK-NEXT: i32.store [[SP]]=, 0([[L8]]), [[SP]]
ret void
}
+; CHECK-LABEL: allocarray_inbounds:
+; CHECK: .local i32, i32, i32, i32{{$}}
define void @allocarray_inbounds() {
; CHECK: i32.const [[L1:.+]]=, __stack_pointer
; CHECK-NEXT: i32.load [[L1]]=, 0([[L1]])
@@ -93,6 +99,7 @@ define void @allocarray_inbounds() {
ret void
}
+; CHECK-LABEL: dynamic_alloca:
define void @dynamic_alloca(i32 %alloc) {
; TODO: Support frame pointers
;%r = alloca i32, i32 %alloc
OpenPOWER on IntegriCloud