Home | History | Annotate | Download | only in Verifier
      1 ; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
      2 
      3 ; PR1042
      4 define i32 @foo() {
      5 ; CHECK: The unwind destination does not have an exception handling instruction
      6 	%A = invoke i32 @foo( )
      7 			to label %L unwind label %L		; <i32> [#uses=1]
      8 L:		; preds = %0, %0
      9 	ret i32 %A
     10 }
     11 
     12 ; PR1042
     13 define i32 @bar() {
     14 	br i1 false, label %L1, label %L2
     15 L1:		; preds = %0
     16 	%A = invoke i32 @bar( )
     17 			to label %L unwind label %L		; <i32> [#uses=1]
     18 L2:		; preds = %0
     19 	br label %L
     20 L:		; preds = %L2, %L1, %L1
     21 ; CHECK: The unwind destination does not have an exception handling instruction
     22 	ret i32 %A
     23 }
     24 
     25 
     26 declare i32 @__gxx_personality_v0(...)
     27 declare void @llvm.donothing()
     28 declare void @llvm.trap()
     29 declare i8 @llvm.expect.i8(i8,i8)
     30 declare i32 @fn(i8 (i8, i8)*)
     31 
     32 define void @f1() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
     33 entry:
     34 ; OK
     35   invoke void @llvm.donothing()
     36   to label %conta unwind label %contb
     37 
     38 conta:
     39   ret void
     40 
     41 contb:
     42   %0 = landingpad { i8*, i32 }
     43           filter [0 x i8*] zeroinitializer
     44   ret void
     45 }
     46 
     47 define i8 @f2() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
     48 entry:
     49 ; CHECK: Cannot invoke an intrinsic other than donothing, patchpoint or statepoint
     50   invoke void @llvm.trap()
     51   to label %cont unwind label %lpad
     52 
     53 cont:
     54   ret i8 3
     55 
     56 lpad:
     57   %0 = landingpad { i8*, i32 }
     58           filter [0 x i8*] zeroinitializer
     59   ret i8 2
     60 }
     61 
     62 define i32 @f3() {
     63 entry:
     64 ; CHECK: Cannot take the address of an intrinsic
     65   %call = call i32 @fn(i8 (i8, i8)* @llvm.expect.i8)
     66   ret i32 %call
     67 }
     68 
     69 define void @f4() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
     70 entry:
     71   invoke void @llvm.donothing()
     72   to label %cont unwind label %cont
     73 
     74 cont:
     75 ; CHECK: Block containing LandingPadInst must be jumped to only by the unwind edge of an invoke.
     76   %0 = landingpad { i8*, i32 }
     77           filter [0 x i8*] zeroinitializer
     78   ret void
     79 }
     80