1 ; RUN: opt -simplifycfg -S < %s | FileCheck %s 2 ; <rdar://problem/13360379> 3 4 @_ZTVN10__cxxabiv117__class_type_infoE = external global i8* 5 @_ZTS13TestException = linkonce_odr constant [16 x i8] c"13TestException\00" 6 @_ZTI13TestException = linkonce_odr unnamed_addr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([16 x i8]* @_ZTS13TestException, i32 0, i32 0) } 7 8 define void @throw(i32 %n) #0 { 9 entry: 10 %exception = call i8* @__cxa_allocate_exception(i64 1) #4 11 call void @__cxa_throw(i8* %exception, i8* bitcast ({ i8*, i8* }* @_ZTI13TestException to i8*), i8* null) #2 12 unreachable 13 } 14 15 define void @func() #0 { 16 entry: 17 ; CHECK: func() 18 ; CHECK: invoke void @throw 19 ; CHECK-NOT: call void @throw 20 invoke void @throw(i32 42) #0 21 to label %exit unwind label %lpad 22 23 lpad: 24 %tmp0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 25 cleanup 26 resume { i8*, i32 } %tmp0 27 28 exit: 29 invoke void @abort() #2 30 to label %invoke.cont unwind label %lpad1 31 32 invoke.cont: 33 unreachable 34 35 lpad1: 36 %tmp1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 37 catch i8* bitcast ({ i8*, i8* }* @_ZTI13TestException to i8*) 38 %tmp2 = extractvalue { i8*, i32 } %tmp1, 1 39 %tmp3 = call i32 @llvm.eh.typeid.for(i8* bitcast ({ i8*, i8* }* @_ZTI13TestException to i8*)) #4 40 %matches = icmp eq i32 %tmp2, %tmp3 41 br i1 %matches, label %catch, label %eh.resume 42 43 catch: 44 ret void 45 46 eh.resume: 47 resume { i8*, i32 } %tmp1 48 } 49 50 define linkonce_odr hidden void @__clang_call_terminate(i8*) #1 { 51 %2 = call i8* @__cxa_begin_catch(i8* %0) #4 52 call void @_ZSt9terminatev() #5 53 unreachable 54 } 55 56 declare void @abort() #2 57 58 declare i32 @llvm.eh.typeid.for(i8*) #3 59 60 declare void @__cxa_end_catch() 61 62 declare i8* @__cxa_allocate_exception(i64) 63 64 declare i32 @__gxx_personality_v0(...) 65 66 declare void @__cxa_throw(i8*, i8*, i8*) 67 68 declare i8* @__cxa_begin_catch(i8*) 69 70 declare void @_ZSt9terminatev() 71 72 attributes #0 = { ssp uwtable } 73 attributes #1 = { noinline noreturn nounwind } 74 attributes #2 = { noreturn } 75 attributes #3 = { nounwind readnone } 76 attributes #4 = { nounwind } 77 attributes #5 = { noreturn nounwind } 78