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 8define void @throw(i32 %n) #0 { 9entry: 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 15define void @func() #0 { 16entry: 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 23lpad: 24 %tmp0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 25 cleanup 26 resume { i8*, i32 } %tmp0 27 28exit: 29 invoke void @abort() #2 30 to label %invoke.cont unwind label %lpad1 31 32invoke.cont: 33 unreachable 34 35lpad1: 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 43catch: 44 ret void 45 46eh.resume: 47 resume { i8*, i32 } %tmp1 48} 49 50define 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 56declare void @abort() #2 57 58declare i32 @llvm.eh.typeid.for(i8*) #3 59 60declare void @__cxa_end_catch() 61 62declare i8* @__cxa_allocate_exception(i64) 63 64declare i32 @__gxx_personality_v0(...) 65 66declare void @__cxa_throw(i8*, i8*, i8*) 67 68declare i8* @__cxa_begin_catch(i8*) 69 70declare void @_ZSt9terminatev() 71 72attributes #0 = { ssp uwtable } 73attributes #1 = { noinline noreturn nounwind } 74attributes #2 = { noreturn } 75attributes #3 = { nounwind readnone } 76attributes #4 = { nounwind } 77attributes #5 = { noreturn nounwind } 78