Model stacksave and stackrestore as both writing memory, since we
[oota-llvm.git] / test / Transforms / Inline / invoke_test-2.ll
1 ; Test that if an invoked function is inlined, and if that function cannot
2 ; throw, that the dead handler is now unreachable.
3
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -inline -simplifycfg | llvm-dis | \
5 ; RUN:   not grep UnreachableExceptionHandler
6
7 declare void %might_throw()
8
9 implementation
10
11 internal int %callee() {
12         invoke void %might_throw() to label %cont except label %exc
13 cont:
14         ret int 0
15 exc:
16         ; This just consumes the exception!
17         ret int 1
18 }
19
20 ; caller returns true if might_throw throws an exception... callee cannot throw.
21 int %caller() {
22         %X = invoke int %callee() to label %cont 
23                 except label %UnreachableExceptionHandler
24 cont:
25         ret int %X
26 UnreachableExceptionHandler:
27         ret int -1   ; This is dead!
28 }