blob: 9262090475a9b55e82428b57103c54dc85641229 [file] [log] [blame]
Chris Lattner0f12ef62003-08-24 06:55:07 +00001; Test that if an invoked function is inlined, and if that function cannot
2; throw, that the dead handler is now unreachable.
3
Reid Spencer951d8dc2007-04-15 08:30:33 +00004; RUN: llvm-upgrade < %s | llvm-as | opt -inline -simplifycfg | llvm-dis | \
5; RUN: not grep UnreachableExceptionHandler
Chris Lattner0f12ef62003-08-24 06:55:07 +00006
7declare void %might_throw()
8
9implementation
10
11internal int %callee() {
12 invoke void %might_throw() to label %cont except label %exc
13cont:
14 ret int 0
15exc:
16 ; This just consumes the exception!
17 ret int 1
18}
19
Chris Lattner1853f282003-08-24 12:16:58 +000020; caller returns true if might_throw throws an exception... callee cannot throw.
Chris Lattner0f12ef62003-08-24 06:55:07 +000021int %caller() {
22 %X = invoke int %callee() to label %cont
23 except label %UnreachableExceptionHandler
24cont:
25 ret int %X
26UnreachableExceptionHandler:
27 ret int -1 ; This is dead!
28}