Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / test / CodeGen / X86 / indirect-branch-tracking-eh.ll
blob8403d4b754d80e494139fe7f3317d7c743ec5296
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
9 ; X86_64-NEXT:          endbr64
10 ; X86_64-NEXT:          pushq   %rax
11 ; X86_64:       .Ltmp0:
12 ; X86_64-NEXT:          callq   _Z20function_that_throwsv
13 ; X86_64-NEXT:  .Ltmp1:
14 ; X86_64-NEXT:  # %bb.1:                                # %try.cont
15 ; X86_64:               retq
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
26 ; X86-NEXT:          endbr32
27 ; X86-NEXT:  .Ltmp0:
28 ; X86:               calll   _Z20function_that_throwsv
29 ; X86-NEXT:  .Ltmp1:
30 ; X86-NEXT:  # %bb.1:                                # %try.cont
31 ; X86-NEXT:          retl
32 ; X86-NEXT:  .LBB0_2:                                # %lpad
33 ; X86-NEXT:  .Ltmp2:
34 ; X86-NEXT:          endbr32
35 ; X86:               calll   __cxa_begin_catch
37 ; NUM-COUNT-3: endbr32
39 ; SJLJ:       test_eh:
40 ; SJLJ-NEXT:  Lfunc_begin0:
41 ; SJLJ-NEXT:  # %bb.0:                                # %entry
42 ; SJLJ-NEXT:          endbr32
43 ; SJLJ:               calll   __Unwind_SjLj_Register
44 ; SJLJ:       Ltmp0:
45 ; SJLJ:               calll   __Z20function_that_throwsv
46 ; SJLJ:       LBB0_2:                                 # %try.cont
47 ; SJLJ:               calll   __Unwind_SjLj_Unregister
48 ; SJLJ:               retl
50 ; SJLJ:       LBB0_3:
51 ; SJLJ-NEXT:          endbr32
52 ; SJLJ-NEXT:          leal
53 ; SJLJ-NEXT:          movl
54 ; SJLJ-NEXT:          cmpl
55 ; SJLJ-NEXT:          jb      LBB0_4
57 ; SJLJ:       LBB0_4:
58 ; SJLJ-NEXT:          jmpl    *LJTI0_0(,%eax,4)
60 ; SJLJ:       LBB0_6:                                 # %lpad
61 ; SJLJ-NEXT:  Ltmp2:
62 ; SJLJ-NEXT:          endbr32
63 ; SJLJ:               calll   ___cxa_begin_catch
64 ; SJLJ:               jmp     LBB0_2
65 ; SJLJ:       LJTI0_0:
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 {
76 entry:
77   invoke void @_Z20function_that_throwsv()
78           to label %try.cont unwind label %lpad
80 lpad:
81   %0 = landingpad { ptr, i32 }
82           catch ptr null
83   %1 = extractvalue { ptr, i32 } %0, 0
84   %2 = tail call ptr @__cxa_begin_catch(ptr %1)
85   tail call void @__cxa_end_catch()
86   br label %try.cont
88 try.cont:
89   ret void
92 !llvm.module.flags = !{!0}
94 !0 = !{i32 8, !"cf-protection-branch", i32 1}