Home | History | Annotate | Download | only in LowerSetJmp
      1 ; RUN: opt < %s -lowersetjmp -S | grep invoke
      2 
      3 @.str_1 = internal constant [13 x i8] c"returned %d\0A\00"		; <[13 x i8]*> [#uses=1]
      4 
      5 declare void @llvm.longjmp(i32*, i32)
      6 
      7 declare i32 @llvm.setjmp(i32*)
      8 
      9 declare void @foo()
     10 
     11 define i32 @simpletest() {
     12 	%B = alloca i32		; <i32*> [#uses=2]
     13 	%Val = call i32 @llvm.setjmp( i32* %B )		; <i32> [#uses=2]
     14 	%V = icmp ne i32 %Val, 0		; <i1> [#uses=1]
     15 	br i1 %V, label %LongJumped, label %Normal
     16 Normal:		; preds = %0
     17 	call void @foo( )
     18 	call void @llvm.longjmp( i32* %B, i32 42 )
     19 	ret i32 0
     20 LongJumped:		; preds = %0
     21 	ret i32 %Val
     22 }
     23 
     24 declare i32 @printf(i8*, ...)
     25 
     26 define i32 @main() {
     27 	%V = call i32 @simpletest( )		; <i32> [#uses=1]
     28 	call i32 (i8*, ...)* @printf( i8* getelementptr ([13 x i8]* @.str_1, i64 0, i64 0), i32 %V )		; <i32>:1 [#uses=0]
     29 	ret i32 0
     30 }
     31 
     32