blob: 8cb6362f34993fc3467853243a38a740a3c22992 [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 | \
Chandler Carruthff123d52012-07-02 19:09:46 +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...
David Majnemer7fddecc2015-06-17 20:52:32 +000015define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
Tanya Lattner5640bd12008-03-01 09:15:35 +000016 invoke void @callee( )
17 to label %cont unwind label %exc
18
19cont: ; preds = %0
20 ret i32 0
21
22exc: ; preds = %0
David Majnemer7fddecc2015-06-17 20:52:32 +000023 %exn = landingpad {i8*, i32}
Bill Wendlingd33e3002011-09-01 01:08:21 +000024 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(...)