2013-12-08 08:51:21 +08:00
|
|
|
; RUN: opt %s -inline -S | FileCheck %s
|
2016-12-27 15:18:43 +08:00
|
|
|
; RUN: opt %s -passes='cgscc(inline)' -S | FileCheck %s
|
2013-12-08 08:51:21 +08:00
|
|
|
|
|
|
|
declare void @external_func()
|
|
|
|
|
|
|
|
@exception_type1 = external global i8
|
|
|
|
@exception_type2 = external global i8
|
|
|
|
|
|
|
|
|
2015-06-18 04:52:32 +08:00
|
|
|
define internal void @inner() personality i8* null {
|
2013-12-08 08:51:21 +08:00
|
|
|
invoke void @external_func()
|
|
|
|
to label %cont unwind label %lpad
|
|
|
|
cont:
|
|
|
|
ret void
|
|
|
|
lpad:
|
2015-06-18 04:52:32 +08:00
|
|
|
%lp = landingpad i32
|
2013-12-08 08:51:21 +08:00
|
|
|
catch i8* @exception_type1
|
|
|
|
resume i32 %lp
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test that the "cleanup" clause is kept when inlining @inner() into
|
|
|
|
; this call site (PR17872), otherwise C++ destructors will not be
|
|
|
|
; called when they should be.
|
|
|
|
|
2015-06-18 04:52:32 +08:00
|
|
|
define void @outer() personality i8* null {
|
2013-12-08 08:51:21 +08:00
|
|
|
invoke void @inner()
|
|
|
|
to label %cont unwind label %lpad
|
|
|
|
cont:
|
|
|
|
ret void
|
|
|
|
lpad:
|
2015-06-18 04:52:32 +08:00
|
|
|
%lp = landingpad i32
|
2013-12-08 08:51:21 +08:00
|
|
|
cleanup
|
|
|
|
catch i8* @exception_type2
|
|
|
|
resume i32 %lp
|
|
|
|
}
|
|
|
|
; CHECK: define void @outer
|
|
|
|
; CHECK: landingpad
|
|
|
|
; CHECK-NEXT: cleanup
|
|
|
|
; CHECK-NEXT: catch i8* @exception_type1
|
|
|
|
; CHECK-NEXT: catch i8* @exception_type2
|