1; RUN: llc %s -o - | FileCheck %s 2; RUN: llc < %s -stop-after=prologepilog | FileCheck %s --check-prefix=PEI 3 4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-unknown-linux-gnu" 6 7$__clang_call_terminate = comdat any 8 9@_ZL11ShouldThrow = internal unnamed_addr global i1 false, align 1 10@_ZTIi = external constant ptr 11@str = private unnamed_addr constant [20 x i8] c"Threw an exception!\00" 12 13; Function Attrs: uwtable 14define void @_Z6throwsv() #0 personality ptr @__gxx_personality_v0 { 15 16; CHECK-LABEL: _Z6throwsv: 17; CHECK: popq %rbp 18; CHECK-NEXT: .cfi_def_cfa %rsp, 8 19; CHECK-NEXT: retq 20; CHECK-NEXT: .LBB0_1: 21; CHECK-NEXT: .cfi_def_cfa %rbp, 16 22 23; PEI-LABEL: name: _Z6throwsv 24; PEI: frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp 25; PEI-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 26; PEI-NEXT: frame-setup CFI_INSTRUCTION offset $rbp, -16 27; PEI-NEXT: $rbp = frame-setup MOV64rr $rsp 28; PEI-NEXT: frame-setup CFI_INSTRUCTION def_cfa_register $rbp 29; PEI-NEXT: frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp 30; PEI-NEXT: frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp 31; PEI-NEXT: {{^ +}}CFI_INSTRUCTION offset $rbx, -24 32; PEI: bb.4.try.cont: 33; PEI-NEXT: $rsp = frame-destroy ADD64ri32 $rsp, 8, implicit-def dead $eflags 34; PEI-NEXT: $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp 35; PEI-NEXT: $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp 36; PEI-NEXT: frame-destroy CFI_INSTRUCTION def_cfa $rsp, 8 37; PEI-NEXT: RET 0 38 39entry: 40 %.b5 = load i1, ptr @_ZL11ShouldThrow, align 1 41 br i1 %.b5, label %if.then, label %try.cont 42 43if.then: ; preds = %entry 44 %exception = tail call ptr @__cxa_allocate_exception(i64 4) 45 store i32 1, ptr %exception, align 16 46 invoke void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null) 47 to label %unreachable unwind label %lpad 48 49lpad: ; preds = %if.then 50 %0 = landingpad { ptr, i32 } 51 catch ptr null 52 %1 = extractvalue { ptr, i32 } %0, 0 53 %2 = tail call ptr @__cxa_begin_catch(ptr %1) 54 %puts = tail call i32 @puts(ptr @str) 55 invoke void @__cxa_rethrow() 56 to label %unreachable unwind label %lpad1 57 58lpad1: ; preds = %lpad 59 %3 = landingpad { ptr, i32 } 60 cleanup 61 invoke void @__cxa_end_catch() 62 to label %eh.resume unwind label %terminate.lpad 63 64try.cont: ; preds = %entry 65 ret void 66 67eh.resume: ; preds = %lpad1 68 resume { ptr, i32 } %3 69 70terminate.lpad: ; preds = %lpad1 71 %4 = landingpad { ptr, i32 } 72 catch ptr null 73 %5 = extractvalue { ptr, i32 } %4, 0 74 tail call void @__clang_call_terminate(ptr %5) 75 unreachable 76 77unreachable: ; preds = %lpad, %if.then 78 unreachable 79} 80 81declare ptr @__cxa_allocate_exception(i64) 82 83declare void @__cxa_throw(ptr, ptr, ptr) 84 85declare i32 @__gxx_personality_v0(...) 86 87declare ptr @__cxa_begin_catch(ptr) 88 89declare void @__cxa_rethrow() 90 91declare void @__cxa_end_catch() 92 93; Function Attrs: noinline noreturn nounwind 94declare void @__clang_call_terminate(ptr) 95 96declare void @_ZSt9terminatev() 97 98; Function Attrs: nounwind 99declare i32 @puts(ptr nocapture readonly) 100 101attributes #0 = { "frame-pointer"="all" } 102 103