1 ; RUN: llc -arm-enable-ehabi -arm-enable-ehabi-descriptors < %s | FileCheck %s 2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S64" 3 target triple = "armv7-none-linux-gnueabi" 4 5 @_ZTIi = external constant i8* 6 7 declare void @_Z3foov() noreturn; 8 9 declare i8* @__cxa_allocate_exception(i32) 10 11 declare i32 @__gxx_personality_v0(...) 12 13 declare void @__cxa_throw(i8*, i8*, i8*) 14 15 declare void @__cxa_call_unexpected(i8*) 16 17 define i32 @main() { 18 ; CHECK-LABEL: main: 19 entry: 20 %exception.i = tail call i8* @__cxa_allocate_exception(i32 4) nounwind 21 %0 = bitcast i8* %exception.i to i32* 22 store i32 42, i32* %0, align 4 23 invoke void @__cxa_throw(i8* %exception.i, i8* bitcast (i8** @_ZTIi to i8*), i8* null) noreturn 24 to label %unreachable.i unwind label %lpad.i 25 26 lpad.i: ; preds = %entry 27 %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 28 filter [1 x i8*] [i8* bitcast (i8** @_ZTIi to i8*)] 29 catch i8* bitcast (i8** @_ZTIi to i8*) 30 ; CHECK: .long _ZTIi(target2) @ TypeInfo 1 31 ; CHECK: .long _ZTIi(target2) @ FilterInfo -1 32 %2 = extractvalue { i8*, i32 } %1, 1 33 %ehspec.fails.i = icmp slt i32 %2, 0 34 br i1 %ehspec.fails.i, label %ehspec.unexpected.i, label %lpad.body 35 36 ehspec.unexpected.i: ; preds = %lpad.i 37 %3 = extractvalue { i8*, i32 } %1, 0 38 invoke void @__cxa_call_unexpected(i8* %3) noreturn 39 to label %.noexc unwind label %lpad 40 41 .noexc: ; preds = %ehspec.unexpected.i 42 unreachable 43 44 unreachable.i: ; preds = %entry 45 unreachable 46 47 lpad: ; preds = %ehspec.unexpected.i 48 %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 49 catch i8* bitcast (i8** @_ZTIi to i8*) 50 br label %lpad.body 51 52 lpad.body: ; preds = %lpad.i, %lpad 53 %eh.lpad-body = phi { i8*, i32 } [ %4, %lpad ], [ %1, %lpad.i ] 54 %5 = extractvalue { i8*, i32 } %eh.lpad-body, 1 55 %6 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) nounwind 56 %matches = icmp eq i32 %5, %6 57 br i1 %matches, label %try.cont, label %eh.resume 58 59 try.cont: ; preds = %lpad.body 60 %7 = extractvalue { i8*, i32 } %eh.lpad-body, 0 61 %8 = tail call i8* @__cxa_begin_catch(i8* %7) nounwind 62 tail call void @__cxa_end_catch() nounwind 63 ret i32 0 64 65 eh.resume: ; preds = %lpad.body 66 resume { i8*, i32 } %eh.lpad-body 67 } 68 69 declare i32 @llvm.eh.typeid.for(i8*) nounwind readnone 70 71 declare i8* @__cxa_begin_catch(i8*) 72 73 declare void @__cxa_end_catch() 74