blob: 1fd3317fd1f24a32b0dcb4ab0de3546e89dee336 [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
Tanya Lattner5640bd12008-03-01 09:15:35 +00004; RUN: llvm-as < %s | opt -inline | llvm-dis | \
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
23 ret i32 1
Chris Lattner0f12ef62003-08-24 06:55:07 +000024}