fix test
[oota-llvm.git] / test / Transforms / LowerSetJmp / simpletest.ll
1 ; RUN: llvm-as < %s | opt -lowersetjmp | llvm-dis | grep invoke
2
3 %JmpBuf = type int
4 %.str_1 = internal constant [13 x sbyte] c"returned %d\0A\00"
5
6 implementation
7
8 declare void %llvm.longjmp(%JmpBuf *%B, int %Val)
9 declare int %llvm.setjmp(%JmpBuf *%B)
10
11 declare void %foo()
12
13 int %simpletest() {
14         %B = alloca %JmpBuf
15         %Val = call int %llvm.setjmp(%JmpBuf* %B)
16         %V = cast int %Val to bool
17         br bool %V, label %LongJumped, label %Normal
18 Normal:
19         call void %foo()
20         call void %llvm.longjmp(%JmpBuf* %B, int 42)
21         ret int 0 ;; not reached
22 LongJumped:
23         ret int %Val
24 }
25
26 declare int %printf(sbyte*, ...)
27
28 int %main() {
29         %V = call int %simpletest()
30         call int(sbyte*, ...)* %printf(sbyte* getelementptr ([13 x sbyte]* %.str_1, long 0, long 0), int %V)
31         ret int 0
32 }