AMDGPU: Add pass to detect used kernel features
[oota-llvm.git] / test / CodeGen / X86 / win32-seh-cleanupendpad.ll
1 ; RUN: llc < %s | FileCheck %s
2
3 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
4 target triple = "i686-pc-windows-msvc"
5
6 define void @nested_finally() #0 personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) {
7 entry:
8   invoke void @f(i32 1) #3
9           to label %invoke.cont unwind label %ehcleanup
10
11 invoke.cont:                                      ; preds = %entry
12   invoke void @f(i32 2) #3
13           to label %invoke.cont.1 unwind label %ehcleanup.3
14
15 invoke.cont.1:                                    ; preds = %invoke.cont
16   call void @f(i32 3) #3
17   ret void
18
19 ehcleanup:                                        ; preds = %entry
20   %0 = cleanuppad []
21   invoke void @f(i32 2) #3
22           to label %invoke.cont.2 unwind label %ehcleanup.end
23
24 invoke.cont.2:                                    ; preds = %ehcleanup
25   cleanupret %0 unwind label %ehcleanup.3
26
27 ehcleanup.end:                                    ; preds = %ehcleanup
28   cleanupendpad %0 unwind label %ehcleanup.3
29
30 ehcleanup.3:                                      ; preds = %invoke.cont.2, %ehcleanup.end, %invoke.cont
31   %1 = cleanuppad []
32   invoke void @f(i32 3) #3
33           to label %invoke.cont.4 unwind label %ehcleanup.end.5
34
35 invoke.cont.4:                                    ; preds = %ehcleanup.3
36   cleanupret %1 unwind to caller
37
38 ehcleanup.end.5:                                  ; preds = %ehcleanup.3
39   cleanupendpad %1 unwind to caller
40 }
41
42 declare void @f(i32) #0
43
44 declare i32 @_except_handler3(...)
45
46 attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
47 attributes #1 = { noinline nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
48 attributes #2 = { nounwind readnone }
49 attributes #3 = { noinline }
50
51 ; CHECK: _nested_finally:
52 ; CHECK: movl $-1, -[[state:[0-9]+]](%ebp)
53 ; CHECK: movl {{.*}}, %fs:0
54 ; CHECK: movl $1, -[[state]](%ebp)
55 ; CHECK: movl $1, (%esp)
56 ; CHECK: calll _f
57 ; CHECK: movl $0, -[[state]](%ebp)
58 ; CHECK: movl $2, (%esp)
59 ; CHECK: calll _f
60 ; CHECK: movl $-1, -[[state]](%ebp)
61 ; CHECK: movl $3, (%esp)
62 ; CHECK: calll _f
63 ; CHECK: retl
64
65 ; CHECK: LBB0_[[inner:[0-9]+]]: # %ehcleanup
66 ; CHECK: pushl %ebp
67 ; CHECK: addl $12, %ebp
68 ; CHECK: movl $0, -[[state]](%ebp)
69 ; CHECK: movl $2, (%esp)
70 ; CHECK: calll _f
71 ; CHECK: popl %ebp
72 ; CHECK: retl
73
74 ; CHECK: LBB0_[[outer:[0-9]+]]: # %ehcleanup.3
75 ; CHECK: pushl %ebp
76 ; CHECK: addl $12, %ebp
77 ; CHECK: movl $-1, -[[state]](%ebp)
78 ; CHECK: movl $3, (%esp)
79 ; CHECK: calll _f
80 ; CHECK: popl %ebp
81 ; CHECK: retl
82
83 ; CHECK: L__ehtable$nested_finally:
84 ; CHECK:        .long   -1
85 ; CHECK:        .long   0
86 ; CHECK:        .long   LBB0_[[outer]]
87 ; CHECK:        .long   0
88 ; CHECK:        .long   0
89 ; CHECK:        .long   LBB0_[[inner]]