blob: e0e6d600bbb362257fcb87cd642d7934feb5754a [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
Dan Gohman18800922009-09-11 18:01:28 +00004; RUN: opt < %s -inline -S | \
Reid Spencer951d8dc2007-04-15 08:30:33 +00005; RUN: not grep {call\[^e\]}
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() {
10 call void @might_throw( )
11 ret void
Chris Lattner0f12ef62003-08-24 06:55:07 +000012}
13
14; caller returns true if might_throw throws an exception...
Tanya Lattner5640bd12008-03-01 09:15:35 +000015define i32 @caller() {
16 invoke void @callee( )
17 to label %cont unwind label %exc
18
19cont: ; preds = %0
20 ret i32 0
21
22exc: ; preds = %0
Bill Wendlingd33e3002011-09-01 01:08:21 +000023 %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
24 cleanup
Tanya Lattner5640bd12008-03-01 09:15:35 +000025 ret i32 1
Chris Lattner0f12ef62003-08-24 06:55:07 +000026}
Bill Wendlingd33e3002011-09-01 01:08:21 +000027
28declare i32 @__gxx_personality_v0(...)