f9cc9c22a92b0d781027d1719816b8d046151a28
[oota-llvm.git] / test / Transforms / InstCombine / stacksaverestore.ll
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep call
2
3 ;; Test that llvm.stackrestore is removed when possible.
4
5 int* %test1(uint %P) {
6         %tmp = call sbyte* %llvm.stacksave()
7         call void %llvm.stackrestore(sbyte* %tmp) ;; not restoring anything
8         %A = alloca int, uint %P
9         ret int* %A
10 }
11
12 void %test2(sbyte* %X) {
13         call void %llvm.stackrestore(sbyte* %X)  ;; no allocas before return.
14         ret void
15 }
16
17 declare sbyte* %llvm.stacksave()
18
19 declare void %llvm.stackrestore(sbyte*)