[WinEH] Require token linkage in EH pad/ret signatures
[oota-llvm.git] / test / CodeGen / WinEH / wineh-statenumbering.ll
1 ; RUN: opt -mtriple=i686-pc-windows-msvc -S -x86-winehstate  < %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 %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
7 %eh.CatchableType = type { i32, i8*, i32, i32, i32, i32, i8* }
8 %eh.CatchableTypeArray.1 = type { i32, [1 x %eh.CatchableType*] }
9 %eh.ThrowInfo = type { i32, i8*, i8*, i8* }
10
11 $"\01??_R0H@8" = comdat any
12
13 $"_CT??_R0H@84" = comdat any
14
15 $_CTA1H = comdat any
16
17 $_TI1H = comdat any
18
19 @"\01??_7type_info@@6B@" = external constant i8*
20 @"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
21 @"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 0, i32 -1, i32 0, i32 4, i8* null }, section ".xdata", comdat
22 @_CTA1H = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.1 { i32 1, [1 x %eh.CatchableType*] [%eh.CatchableType* @"_CT??_R0H@84"] }, section ".xdata", comdat
23 @_TI1H = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @_CTA1H to i8*) }, section ".xdata", comdat
24
25 define i32 @main() #0 personality i32 (...)* @__CxxFrameHandler3 {
26 entry:
27   %tmp = alloca i32, align 4
28   ; CHECK: entry:
29   ; CHECK:   store i32 -1
30   ; CHECK:   call void @g(i32 3)
31   call void @g(i32 3)
32   store i32 0, i32* %tmp, align 4
33   %0 = bitcast i32* %tmp to i8*
34   ; CHECK:   store i32 0
35   ; CHECK:   invoke void @_CxxThrowException(
36   invoke void @_CxxThrowException(i8* %0, %eh.ThrowInfo* nonnull @_TI1H) #1
37           to label %unreachable.for.entry unwind label %catch.dispatch
38
39 catch.dispatch:                                   ; preds = %entry
40   %1 = catchpad [i8* null, i8* null] to label %catch unwind label %catchendblock
41
42 catch:                                            ; preds = %catch.dispatch
43   ; CHECK: catch:
44   ; CHECK:   store i32 2
45   ; CHECK:   invoke void @_CxxThrowException(
46   invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #1
47           to label %unreachable unwind label %catch.dispatch.1
48
49 catch.dispatch.1:                                 ; preds = %catch
50   %2 = catchpad [i8* null, i8* null] to label %catch.3 unwind label %catchendblock.2
51
52 catch.3:                                          ; preds = %catch.dispatch.1
53   ; CHECK: catch.3:
54   ; CHECK:   store i32 3
55   ; CHECK:   invoke void @g(i32 1)
56   invoke void @g(i32 1)
57           to label %invoke.cont unwind label %catchendblock.2
58
59 invoke.cont:                                      ; preds = %catch.3
60   catchret %2 to label %try.cont
61
62 try.cont:                                         ; preds = %invoke.cont
63   ; CHECK: try.cont:
64   ; CHECK:   store i32 1
65   ; CHECK:   invoke void @g(i32 2)
66   invoke void @g(i32 2)
67           to label %invoke.cont.4 unwind label %catchendblock
68
69 invoke.cont.4:                                    ; preds = %try.cont
70   unreachable
71
72 catchendblock.2:                                  ; preds = %catch.3, %catch.dispatch.1
73   catchendpad unwind label %catchendblock
74
75 catchendblock:                                    ; preds = %catchendblock.2, %try.cont, %catch.dispatch
76   catchendpad unwind to caller
77
78 unreachable:                                      ; preds = %catch
79   unreachable
80
81 unreachable.for.entry:                            ; preds = %entry
82   unreachable
83 }
84
85 declare void @g(i32) #0
86
87 declare x86_stdcallcc void @_CxxThrowException(i8*, %eh.ThrowInfo*)
88
89 declare i32 @__CxxFrameHandler3(...)
90
91 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" }
92 attributes #1 = { noreturn }
93
94 !llvm.ident = !{!0}
95
96 !0 = !{!"clang version 3.8.0 (trunk 245153) (llvm/trunk 245238)"}