1; RUN: llc %s -o - | FileCheck %s 2 3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4target triple = "x86_64-unknown-linux-gnu" 5 6$__clang_call_terminate = comdat any 7 8@_ZL11ShouldThrow = internal unnamed_addr global i1 false, align 1 9@_ZTIi = external constant i8* 10@str = private unnamed_addr constant [20 x i8] c"Threw an exception!\00" 11 12; Function Attrs: uwtable 13define void @_Z6throwsv() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { 14 15; CHECK-LABEL: _Z6throwsv: 16; CHECK: popq %rbx 17; CHECK-NEXT: .cfi_def_cfa_offset 8 18; CHECK-NEXT: retq 19; CHECK-NEXT: .LBB0_1: 20; CHECK-NEXT: .cfi_def_cfa_offset 16 21 22entry: 23 %.b5 = load i1, i1* @_ZL11ShouldThrow, align 1 24 br i1 %.b5, label %if.then, label %try.cont 25 26if.then: ; preds = %entry 27 %exception = tail call i8* @__cxa_allocate_exception(i64 4) 28 %0 = bitcast i8* %exception to i32* 29 store i32 1, i32* %0, align 16 30 invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) 31 to label %unreachable unwind label %lpad 32 33lpad: ; preds = %if.then 34 %1 = landingpad { i8*, i32 } 35 catch i8* null 36 %2 = extractvalue { i8*, i32 } %1, 0 37 %3 = tail call i8* @__cxa_begin_catch(i8* %2) 38 %puts = tail call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0)) 39 invoke void @__cxa_rethrow() #4 40 to label %unreachable unwind label %lpad1 41 42lpad1: ; preds = %lpad 43 %4 = landingpad { i8*, i32 } 44 cleanup 45 invoke void @__cxa_end_catch() 46 to label %eh.resume unwind label %terminate.lpad 47 48try.cont: ; preds = %entry 49 ret void 50 51eh.resume: ; preds = %lpad1 52 resume { i8*, i32 } %4 53 54terminate.lpad: ; preds = %lpad1 55 %5 = landingpad { i8*, i32 } 56 catch i8* null 57 %6 = extractvalue { i8*, i32 } %5, 0 58 tail call void @__clang_call_terminate(i8* %6) 59 unreachable 60 61unreachable: ; preds = %lpad, %if.then 62 unreachable 63} 64 65declare i8* @__cxa_allocate_exception(i64) 66 67declare void @__cxa_throw(i8*, i8*, i8*) 68 69declare i32 @__gxx_personality_v0(...) 70 71declare i8* @__cxa_begin_catch(i8*) 72 73declare void @__cxa_rethrow() 74 75declare void @__cxa_end_catch() 76 77; Function Attrs: noinline noreturn nounwind 78declare void @__clang_call_terminate(i8*) 79 80declare void @_ZSt9terminatev() 81 82 83; Function Attrs: nounwind 84declare i32 @puts(i8* nocapture readonly) 85 86