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