1*9880d681SAndroid Build Coastguard Worker; RUN: opt %s -inline -S | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdeclare void @external_func() 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker@exception_type1 = external global i8 6*9880d681SAndroid Build Coastguard Worker@exception_type2 = external global i8 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Workerdefine internal void @inner() personality i8* null { 10*9880d681SAndroid Build Coastguard Worker invoke void @external_func() 11*9880d681SAndroid Build Coastguard Worker to label %cont unwind label %lpad 12*9880d681SAndroid Build Coastguard Workercont: 13*9880d681SAndroid Build Coastguard Worker ret void 14*9880d681SAndroid Build Coastguard Workerlpad: 15*9880d681SAndroid Build Coastguard Worker %lp = landingpad i32 16*9880d681SAndroid Build Coastguard Worker catch i8* @exception_type1 17*9880d681SAndroid Build Coastguard Worker resume i32 %lp 18*9880d681SAndroid Build Coastguard Worker} 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker; Test that the "cleanup" clause is kept when inlining @inner() into 21*9880d681SAndroid Build Coastguard Worker; this call site (PR17872), otherwise C++ destructors will not be 22*9880d681SAndroid Build Coastguard Worker; called when they should be. 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Workerdefine void @outer() personality i8* null { 25*9880d681SAndroid Build Coastguard Worker invoke void @inner() 26*9880d681SAndroid Build Coastguard Worker to label %cont unwind label %lpad 27*9880d681SAndroid Build Coastguard Workercont: 28*9880d681SAndroid Build Coastguard Worker ret void 29*9880d681SAndroid Build Coastguard Workerlpad: 30*9880d681SAndroid Build Coastguard Worker %lp = landingpad i32 31*9880d681SAndroid Build Coastguard Worker cleanup 32*9880d681SAndroid Build Coastguard Worker catch i8* @exception_type2 33*9880d681SAndroid Build Coastguard Worker resume i32 %lp 34*9880d681SAndroid Build Coastguard Worker} 35*9880d681SAndroid Build Coastguard Worker; CHECK: define void @outer 36*9880d681SAndroid Build Coastguard Worker; CHECK: landingpad 37*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: cleanup 38*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: catch i8* @exception_type1 39*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: catch i8* @exception_type2 40