1 ; RUN: opt -simplifycfg -S < %s | FileCheck %s
2 ; <rdar://problem/13360379>
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) }
8 define void @throw(i32 %n) #0 {
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
15 define void @func() #0 {
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
24 %tmp0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
26 resume { i8*, i32 } %tmp0
29 invoke void @abort() #2
30 to label %invoke.cont unwind label %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
47 resume { i8*, i32 } %tmp1
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
56 declare void @abort() #2
58 declare i32 @llvm.eh.typeid.for(i8*) #3
60 declare void @__cxa_end_catch()
62 declare i8* @__cxa_allocate_exception(i64)
64 declare i32 @__gxx_personality_v0(...)
66 declare void @__cxa_throw(i8*, i8*, i8*)
68 declare i8* @__cxa_begin_catch(i8*)
70 declare void @_ZSt9terminatev()
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 }