1 ; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s --check-prefix=X86_64
2 ; RUN: llc -mtriple=i386-unknown-unknown < %s | FileCheck %s --check-prefix=X86
3 ; RUN: llc -mtriple i386-windows-gnu -exception-model sjlj -verify-machineinstrs=0 < %s | FileCheck %s --check-prefix=SJLJ
4 ; RUN: llc -mtriple i386-windows-gnu -exception-model sjlj -verify-machineinstrs=0 < %s | FileCheck %s --check-prefix=NUM
6 ; X86_64: test_eh: # @test_eh
7 ; X86_64-NEXT: .Lfunc_begin0:
8 ; X86_64: # %bb.0: # %entry
10 ; X86_64-NEXT: pushq %rax
12 ; X86_64-NEXT: callq _Z20function_that_throwsv
13 ; X86_64-NEXT: .Ltmp1:
14 ; X86_64-NEXT: # %bb.1: # %try.cont
16 ; X86_64-NEXT: .LBB0_2: # %lpad
17 ; X86_64-NEXT: .cfi_def_cfa_offset 16
18 ; X86_64-NEXT: .Ltmp2:
19 ; X86_64-NEXT: endbr64
20 ; X86_64: callq __cxa_begin_catch
23 ; X86: test_eh: # @test_eh
24 ; X86-NEXT: .Lfunc_begin0:
25 ; X86: # %bb.0: # %entry
28 ; X86: calll _Z20function_that_throwsv
30 ; X86-NEXT: # %bb.1: # %try.cont
32 ; X86-NEXT: .LBB0_2: # %lpad
35 ; X86: calll __cxa_begin_catch
37 ; NUM-COUNT-3: endbr32
40 ; SJLJ-NEXT: Lfunc_begin0:
41 ; SJLJ-NEXT: # %bb.0: # %entry
43 ; SJLJ: calll __Unwind_SjLj_Register
45 ; SJLJ: calll __Z20function_that_throwsv
46 ; SJLJ: LBB0_2: # %try.cont
47 ; SJLJ: calll __Unwind_SjLj_Unregister
55 ; SJLJ-NEXT: jb LBB0_4
58 ; SJLJ-NEXT: jmpl *LJTI0_0(,%eax,4)
60 ; SJLJ: LBB0_6: # %lpad
63 ; SJLJ: calll ___cxa_begin_catch
66 ; SJLJ-NEXT: .long LBB0_6
70 declare void @_Z20function_that_throwsv()
71 declare i32 @__gxx_personality_sj0(...)
72 declare ptr @__cxa_begin_catch(ptr)
73 declare void @__cxa_end_catch()
75 define void @test_eh() personality ptr @__gxx_personality_sj0 {
77 invoke void @_Z20function_that_throwsv()
78 to label %try.cont unwind label %lpad
81 %0 = landingpad { ptr, i32 }
83 %1 = extractvalue { ptr, i32 } %0, 0
84 %2 = tail call ptr @__cxa_begin_catch(ptr %1)
85 tail call void @__cxa_end_catch()
92 !llvm.module.flags = !{!0}
94 !0 = !{i32 8, !"cf-protection-branch", i32 1}