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 within none [] 21 invoke void @f(i32 2) #3 [ "funclet"(token %0) ] 22 to label %invoke.cont.2 unwind label %ehcleanup.3 23 24 invoke.cont.2: ; preds = %ehcleanup 25 cleanupret from %0 unwind label %ehcleanup.3 26 27 ehcleanup.3: ; preds = %invoke.cont.2, %ehcleanup.end, %invoke.cont 28 %1 = cleanuppad within none [] 29 call void @f(i32 3) #3 [ "funclet"(token %1) ] 30 cleanupret from %1 unwind to caller 31 } 32 33 declare void @f(i32) #0 34 35 declare i32 @_except_handler3(...) 36 37 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" } 38 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" } 39 attributes #2 = { nounwind readnone } 40 attributes #3 = { noinline } 41 42 ; CHECK: _nested_finally: 43 ; CHECK: movl $-1, -[[state:[0-9]+]](%ebp) 44 ; CHECK: movl {{.*}}, %fs:0 45 ; CHECK: movl $1, -[[state]](%ebp) 46 ; CHECK: pushl $1 47 ; CHECK: calll _f 48 ; CHECK: addl $4, %esp 49 ; CHECK: movl $0, -[[state]](%ebp) 50 ; CHECK: pushl $2 51 ; CHECK: calll _f 52 ; CHECK: addl $4, %esp 53 ; CHECK: movl $-1, -[[state]](%ebp) 54 ; CHECK: pushl $3 55 ; CHECK: calll _f 56 ; CHECK: addl $4, %esp 57 ; CHECK: retl 58 59 ; CHECK: LBB0_[[inner:[0-9]+]]: # %ehcleanup 60 ; CHECK: pushl %ebp 61 ; CHECK: addl $12, %ebp 62 ; CHECK: pushl $2 63 ; CHECK: calll _f 64 ; CHECK: addl $4, %esp 65 ; CHECK: addl $4, %esp 66 ; CHECK: popl %ebp 67 ; CHECK: retl 68 69 ; CHECK: LBB0_[[outer:[0-9]+]]: # %ehcleanup.3 70 ; CHECK: pushl %ebp 71 ; CHECK: addl $12, %ebp 72 ; CHECK: pushl $3 73 ; CHECK: calll _f 74 ; CHECK: addl $8, %esp 75 ; CHECK: popl %ebp 76 ; CHECK: retl 77 78 ; CHECK: L__ehtable$nested_finally: 79 ; CHECK: .long -1 # ToState 80 ; CHECK: .long 0 # Null 81 ; CHECK: .long "?dtor$[[outer]]@?0?nested_finally@4HA" # FinallyFunclet 82 ; CHECK: .long 0 # ToState 83 ; CHECK: .long 0 # Null 84 ; CHECK: .long "?dtor$[[inner]]@?0?nested_finally@4HA" # FinallyFunclet 85