blob: 0913f7c24d9d86545a0924743ef949f3fff3351e [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 Spencerd0e30dc2006-12-02 04:23:10 +00004; RUN: llvm-upgrade < %s | llvm-as | opt -inline -simplifycfg | llvm-dis | not grep UnreachableExceptionHandler
Chris Lattner0f12ef62003-08-24 06:55:07 +00005
6declare void %might_throw()
7
8implementation
9
10internal int %callee() {
11 invoke void %might_throw() to label %cont except label %exc
12cont:
13 ret int 0
14exc:
15 ; This just consumes the exception!
16 ret int 1
17}
18
Chris Lattner1853f282003-08-24 12:16:58 +000019; caller returns true if might_throw throws an exception... callee cannot throw.
Chris Lattner0f12ef62003-08-24 06:55:07 +000020int %caller() {
21 %X = invoke int %callee() to label %cont
22 except label %UnreachableExceptionHandler
23cont:
24 ret int %X
25UnreachableExceptionHandler:
26 ret int -1 ; This is dead!
27}