Add a test for r253323
[oota-llvm.git] / test / Transforms / TailCallElim / setjmp.ll
1 ; RUN: opt < %s -tailcallelim -S | FileCheck %s
2
3 ; Test that we don't tail call in a functions that calls returns_twice
4 ; functions.
5
6 declare void @bar()
7
8 ; CHECK: foo1
9 ; CHECK-NOT: tail call void @bar()
10
11 define void @foo1(i32* %x) {
12 bb:
13   %tmp75 = tail call i32 @setjmp(i32* %x)
14   call void @bar()
15   ret void
16 }
17
18 declare i32 @setjmp(i32*) returns_twice
19
20 ; CHECK: foo2
21 ; CHECK-NOT: tail call void @bar()
22
23 define void @foo2(i32* %x) {
24 bb:
25   %tmp75 = tail call i32 @zed2(i32* %x)
26   call void @bar()
27   ret void
28 }
29 declare i32 @zed2(i32*) returns_twice