2003-08-24 06:55:07 +00:00
|
|
|
; Test that any rethrown exceptions in an inlined function are automatically
|
|
|
|
; turned into branches to the invoke destination.
|
|
|
|
|
2003-08-24 12:53:20 +00:00
|
|
|
; RUN: as < %s | opt -inline | dis | not grep 'call void %llvm.unwind'
|
2003-08-24 06:55:07 +00:00
|
|
|
|
|
|
|
declare void %might_throw()
|
2003-08-24 12:53:20 +00:00
|
|
|
declare void %llvm.unwind()
|
2003-08-24 06:55:07 +00:00
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
internal int %callee() {
|
|
|
|
invoke void %might_throw() to label %cont except label %exc
|
|
|
|
cont:
|
|
|
|
ret int 0
|
|
|
|
exc: ; This just rethrows the exception!
|
2003-08-24 12:53:20 +00:00
|
|
|
call void %llvm.unwind()
|
2003-08-24 12:16:58 +00:00
|
|
|
ret int 123 ; DEAD!
|
2003-08-24 06:55:07 +00:00
|
|
|
}
|
|
|
|
|
2003-08-24 12:16:58 +00:00
|
|
|
; caller returns true if might_throw throws an exception... which gets
|
|
|
|
; propagated by callee.
|
2003-08-24 06:55:07 +00:00
|
|
|
int %caller() {
|
|
|
|
%X = invoke int %callee() to label %cont
|
|
|
|
except label %Handler
|
|
|
|
cont:
|
|
|
|
ret int %X
|
|
|
|
Handler:
|
|
|
|
; This consumes an exception thrown by might_throw
|
2003-08-24 12:16:58 +00:00
|
|
|
ret int 1
|
2003-08-24 06:55:07 +00:00
|
|
|
}
|