Chandler Carruth | 49589f0 | 2012-07-02 18:37:59 +0000 | [diff] [blame] | 1 | ; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s |
Nuno Lopes | 917f97c | 2012-06-28 22:57:00 +0000 | [diff] [blame] | 2 | |
| 3 | ; PR1042 |
| 4 | define i32 @foo() { |
| 5 | ; CHECK: The unwind destination does not have a landingpad 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 a landingpad instruction |
| 22 | ; CHECK: Instruction does not dominate all uses |
| 23 | ret i32 %A |
| 24 | } |
| 25 | |
| 26 | |
| 27 | declare i32 @__gxx_personality_v0(...) |
| 28 | declare void @llvm.donothing() |
| 29 | declare void @llvm.trap() |
| 30 | declare i8 @llvm.expect.i8(i8,i8) |
| 31 | declare i32 @fn(i8 (i8, i8)*) |
| 32 | |
| 33 | define void @f1() { |
| 34 | entry: |
| 35 | ; OK |
| 36 | invoke void @llvm.donothing() |
| 37 | to label %cont unwind label %cont |
| 38 | |
| 39 | cont: |
| 40 | %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) |
| 41 | filter [0 x i8*] zeroinitializer |
| 42 | ret void |
| 43 | } |
| 44 | |
| 45 | define i8 @f2() { |
| 46 | entry: |
| 47 | ; CHECK: Cannot invoke an intrinsinc other than donothing |
| 48 | invoke void @llvm.trap() |
| 49 | to label %cont unwind label %lpad |
| 50 | |
| 51 | cont: |
| 52 | ret i8 3 |
| 53 | |
| 54 | lpad: |
| 55 | %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) |
| 56 | filter [0 x i8*] zeroinitializer |
| 57 | ret i8 2 |
| 58 | } |
| 59 | |
| 60 | define i32 @f3() { |
| 61 | entry: |
| 62 | ; CHECK: Cannot take the address of an intrinsic |
| 63 | %call = call i32 @fn(i8 (i8, i8)* @llvm.expect.i8) |
| 64 | ret i32 %call |
| 65 | } |