llvm-project/llvm/test/CodeGen/X86/indirect-branch-tracking-eh.ll

95 lines
3.1 KiB
LLVM

; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s --check-prefix=X86_64
; RUN: llc -mtriple=i386-unknown-unknown < %s | FileCheck %s --check-prefix=X86
; RUN: llc -mtriple i386-windows-gnu -exception-model sjlj -verify-machineinstrs=0 < %s | FileCheck %s --check-prefix=SJLJ
; RUN: llc -mtriple i386-windows-gnu -exception-model sjlj -verify-machineinstrs=0 < %s | FileCheck %s --check-prefix=NUM
; X86_64: test_eh: # @test_eh
; X86_64-NEXT: .Lfunc_begin0:
; X86_64: # %bb.0: # %entry
; X86_64-NEXT: endbr64
; X86_64-NEXT: pushq %rax
; X86_64: .Ltmp0:
; X86_64-NEXT: callq _Z20function_that_throwsv
; X86_64-NEXT: .Ltmp1:
; X86_64-NEXT: # %bb.1: # %try.cont
; X86_64: retq
; X86_64-NEXT: .LBB0_2: # %lpad
; X86_64-NEXT: .cfi_def_cfa_offset 16
; X86_64-NEXT: .Ltmp2:
; X86_64-NEXT: endbr64
; X86_64: callq __cxa_begin_catch
; X86: test_eh: # @test_eh
; X86-NEXT: .Lfunc_begin0:
; X86: # %bb.0: # %entry
; X86-NEXT: endbr32
; X86-NEXT: .Ltmp0:
; X86: calll _Z20function_that_throwsv
; X86-NEXT: .Ltmp1:
; X86-NEXT: # %bb.1: # %try.cont
; X86-NEXT: retl
; X86-NEXT: .LBB0_2: # %lpad
; X86-NEXT: .Ltmp2:
; X86-NEXT: endbr32
; X86: calll __cxa_begin_catch
; NUM-COUNT-3: endbr32
; SJLJ: test_eh:
; SJLJ-NEXT: Lfunc_begin0:
; SJLJ-NEXT: # %bb.0: # %entry
; SJLJ-NEXT: endbr32
; SJLJ: calll __Unwind_SjLj_Register
; SJLJ: Ltmp0:
; SJLJ: calll __Z20function_that_throwsv
; SJLJ: LBB0_2: # %try.cont
; SJLJ: calll __Unwind_SjLj_Unregister
; SJLJ: retl
; SJLJ: LBB0_3:
; SJLJ-NEXT: endbr32
; SJLJ-NEXT: leal
; SJLJ-NEXT: movl
; SJLJ-NEXT: cmpl
; SJLJ-NEXT: jb LBB0_4
; SJLJ: LBB0_4:
; SJLJ-NEXT: jmpl *LJTI0_0(,%eax,4)
; SJLJ: LBB0_6: # %lpad
; SJLJ-NEXT: Ltmp2:
; SJLJ-NEXT: endbr32
; SJLJ: calll ___cxa_begin_catch
; SJLJ: jmp LBB0_2
; SJLJ: LJTI0_0:
; SJLJ-NEXT: .long LBB0_6
declare void @_Z20function_that_throwsv()
declare i32 @__gxx_personality_sj0(...)
declare i8* @__cxa_begin_catch(i8*)
declare void @__cxa_end_catch()
define void @test_eh() personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) {
entry:
invoke void @_Z20function_that_throwsv()
to label %try.cont unwind label %lpad
lpad:
%0 = landingpad { i8*, i32 }
catch i8* null
%1 = extractvalue { i8*, i32 } %0, 0
%2 = tail call i8* @__cxa_begin_catch(i8* %1)
tail call void @__cxa_end_catch()
br label %try.cont
try.cont:
ret void
}
!llvm.module.flags = !{!0}
!0 = !{i32 4, !"cf-protection-branch", i32 1}