xref: /aosp_15_r20/external/llvm/test/Transforms/TailCallElim/setjmp.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -tailcallelim -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Test that we don't tail call in a functions that calls returns_twice
4*9880d681SAndroid Build Coastguard Worker; functions.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdeclare void @bar()
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; CHECK: foo1
9*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: tail call void @bar()
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdefine void @foo1(i32* %x) {
12*9880d681SAndroid Build Coastguard Workerbb:
13*9880d681SAndroid Build Coastguard Worker  %tmp75 = tail call i32 @setjmp(i32* %x)
14*9880d681SAndroid Build Coastguard Worker  call void @bar()
15*9880d681SAndroid Build Coastguard Worker  ret void
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdeclare i32 @setjmp(i32*) returns_twice
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker; CHECK: foo2
21*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: tail call void @bar()
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerdefine void @foo2(i32* %x) {
24*9880d681SAndroid Build Coastguard Workerbb:
25*9880d681SAndroid Build Coastguard Worker  %tmp75 = tail call i32 @zed2(i32* %x)
26*9880d681SAndroid Build Coastguard Worker  call void @bar()
27*9880d681SAndroid Build Coastguard Worker  ret void
28*9880d681SAndroid Build Coastguard Worker}
29*9880d681SAndroid Build Coastguard Workerdeclare i32 @zed2(i32*) returns_twice
30