2006-12-02 05:23:10 +01:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | opt -lowersetjmp | llvm-dis | grep invoke
|
2003-05-18 00:18:33 +02:00
|
|
|
|
|
|
|
%JmpBuf = type int
|
|
|
|
%.str_1 = internal constant [13 x sbyte] c"returned %d\0A\00"
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
declare void %llvm.longjmp(%JmpBuf *%B, int %Val)
|
|
|
|
declare int %llvm.setjmp(%JmpBuf *%B)
|
|
|
|
|
2003-10-23 17:57:45 +02:00
|
|
|
declare void %foo()
|
|
|
|
|
2003-05-18 00:18:33 +02:00
|
|
|
int %simpletest() {
|
|
|
|
%B = alloca %JmpBuf
|
|
|
|
%Val = call int %llvm.setjmp(%JmpBuf* %B)
|
|
|
|
%V = cast int %Val to bool
|
|
|
|
br bool %V, label %LongJumped, label %Normal
|
|
|
|
Normal:
|
2003-10-23 17:57:45 +02:00
|
|
|
call void %foo()
|
2003-05-18 00:18:33 +02:00
|
|
|
call void %llvm.longjmp(%JmpBuf* %B, int 42)
|
|
|
|
ret int 0 ;; not reached
|
|
|
|
LongJumped:
|
|
|
|
ret int %Val
|
|
|
|
}
|
|
|
|
|
|
|
|
declare int %printf(sbyte*, ...)
|
|
|
|
|
|
|
|
int %main() {
|
|
|
|
%V = call int %simpletest()
|
|
|
|
call int(sbyte*, ...)* %printf(sbyte* getelementptr ([13 x sbyte]* %.str_1, long 0, long 0), int %V)
|
|
|
|
ret int 0
|
|
|
|
}
|