blob: a5964121866ec9e17c6e3160a68010e959fa48f7 [file] [log] [blame]
Chris Lattner1853f282003-08-24 12:16:58 +00001; Test that we can inline a simple function, turning the calls in it into invoke
Chris Lattner0f12ef62003-08-24 06:55:07 +00002; instructions
3
Chandler Carruth62c8b812016-12-27 02:47:37 +00004; RUN: opt < %s -inline -S | FileCheck %s
Chandler Carruth625038d2016-12-27 07:18:43 +00005; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s
Chris Lattner0f12ef62003-08-24 06:55:07 +00006
Tanya Lattner5640bd12008-03-01 09:15:35 +00007declare void @might_throw()
Chris Lattner0f12ef62003-08-24 06:55:07 +00008
Tanya Lattner5640bd12008-03-01 09:15:35 +00009define internal void @callee() {
Chandler Carruth62c8b812016-12-27 02:47:37 +000010entry:
11 call void @might_throw()
12 ret void
Chris Lattner0f12ef62003-08-24 06:55:07 +000013}
14
15; caller returns true if might_throw throws an exception...
David Majnemer7fddecc2015-06-17 20:52:32 +000016define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
Chandler Carruth62c8b812016-12-27 02:47:37 +000017; CHECK-LABEL: define i32 @caller() personality i32 (...)* @__gxx_personality_v0
18entry:
19 invoke void @callee()
20 to label %cont unwind label %exc
21; CHECK-NOT: @callee
22; CHECK: invoke void @might_throw()
Tanya Lattner5640bd12008-03-01 09:15:35 +000023
Chandler Carruth62c8b812016-12-27 02:47:37 +000024cont:
25 ret i32 0
Tanya Lattner5640bd12008-03-01 09:15:35 +000026
Chandler Carruth62c8b812016-12-27 02:47:37 +000027exc:
28 %exn = landingpad {i8*, i32}
29 cleanup
30 ret i32 1
Chris Lattner0f12ef62003-08-24 06:55:07 +000031}
Bill Wendlingd33e3002011-09-01 01:08:21 +000032
33declare i32 @__gxx_personality_v0(...)