Re-land r235154-r235156 under the existing -sehprepare flag
[oota-llvm.git] / test / CodeGen / X86 / seh-catch-all.ll
1 ; RUN: llc -sehprepare -mtriple=x86_64-windows-msvc < %s | FileCheck %s
2 ; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s
3
4 @str = internal unnamed_addr constant [10 x i8] c"recovered\00", align 1
5
6 declare i32 @__C_specific_handler(...)
7 declare void @crash()
8 declare i32 @puts(i8*)
9
10 define i32 @main() {
11 entry:
12   invoke void @crash()
13           to label %__try.cont unwind label %lpad
14
15 lpad:
16   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
17           catch i8* null
18   call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
19   br label %__try.cont
20
21 __try.cont:
22   ret i32 0
23
24 eh.resume:
25   resume { i8*, i32 } %0
26 }
27
28 ; CHECK-LABEL: main:
29 ; CHECK: .seh_handlerdata
30 ; CHECK-NEXT: .long 1
31 ; CHECK-NEXT: .Ltmp{{[0-9]+}}@IMGREL
32 ; CHECK-NEXT: .Ltmp{{[0-9]+}}@IMGREL+1
33 ; CHECK-NEXT: 1
34 ; CHECK-NEXT: .Ltmp{{[0-9]+}}@IMGREL