Chris Lattner | b42c8f7 | 2007-11-13 07:32:38 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep bb17 |
| 2 | ; PR1786 |
| 3 | |
| 4 | define i32 @main() { |
| 5 | entry: |
| 6 | %retval = alloca i32, align 4 ; <i32*> [#uses=1] |
| 7 | %i = alloca i32, align 4 ; <i32*> [#uses=7] |
| 8 | %z = alloca i32, align 4 ; <i32*> [#uses=4] |
| 9 | %z16 = alloca i32, align 4 ; <i32*> [#uses=4] |
| 10 | %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] |
| 11 | store i32 0, i32* %i |
| 12 | %toBool = icmp ne i8 1, 0 ; <i1> [#uses=1] |
| 13 | br i1 %toBool, label %cond_true, label %cond_false |
| 14 | |
| 15 | cond_true: ; preds = %entry |
| 16 | store i32 0, i32* %z |
| 17 | br label %bb |
| 18 | |
| 19 | bb: ; preds = %cond_next, %cond_true |
| 20 | %tmp = load i32* %z ; <i32> [#uses=1] |
| 21 | %tmp1 = sub i32 %tmp, 16384 ; <i32> [#uses=1] |
| 22 | store i32 %tmp1, i32* %z |
| 23 | %tmp2 = load i32* %i ; <i32> [#uses=1] |
| 24 | %tmp3 = add i32 %tmp2, 1 ; <i32> [#uses=1] |
| 25 | store i32 %tmp3, i32* %i |
| 26 | %tmp4 = load i32* %i ; <i32> [#uses=1] |
| 27 | %tmp5 = icmp sgt i32 %tmp4, 262144 ; <i1> [#uses=1] |
| 28 | %tmp56 = zext i1 %tmp5 to i8 ; <i8> [#uses=1] |
| 29 | %toBool7 = icmp ne i8 %tmp56, 0 ; <i1> [#uses=1] |
| 30 | br i1 %toBool7, label %cond_true8, label %cond_next |
| 31 | |
| 32 | cond_true8: ; preds = %bb |
| 33 | call void @abort( ) |
| 34 | unreachable |
| 35 | |
| 36 | cond_next: ; preds = %bb |
| 37 | %tmp9 = load i32* %z ; <i32> [#uses=1] |
| 38 | %tmp10 = icmp ne i32 %tmp9, 0 ; <i1> [#uses=1] |
| 39 | %tmp1011 = zext i1 %tmp10 to i8 ; <i8> [#uses=1] |
| 40 | %toBool12 = icmp ne i8 %tmp1011, 0 ; <i1> [#uses=1] |
| 41 | br i1 %toBool12, label %bb, label %bb13 |
| 42 | |
| 43 | bb13: ; preds = %cond_next |
| 44 | call void @exit( i32 0 ) |
| 45 | unreachable |
| 46 | |
| 47 | cond_false: ; preds = %entry |
| 48 | %toBool14 = icmp ne i8 1, 0 ; <i1> [#uses=1] |
| 49 | br i1 %toBool14, label %cond_true15, label %cond_false33 |
| 50 | |
| 51 | cond_true15: ; preds = %cond_false |
| 52 | store i32 0, i32* %z16 |
| 53 | br label %bb17 |
| 54 | |
| 55 | bb17: ; preds = %cond_next27, %cond_true15 |
| 56 | %tmp18 = load i32* %z16 ; <i32> [#uses=1] |
| 57 | %tmp19 = sub i32 %tmp18, 16384 ; <i32> [#uses=1] |
| 58 | store i32 %tmp19, i32* %z16 |
| 59 | %tmp20 = load i32* %i ; <i32> [#uses=1] |
| 60 | %tmp21 = add i32 %tmp20, 1 ; <i32> [#uses=1] |
| 61 | store i32 %tmp21, i32* %i |
| 62 | %tmp22 = load i32* %i ; <i32> [#uses=1] |
| 63 | %tmp23 = icmp sgt i32 %tmp22, 262144 ; <i1> [#uses=1] |
| 64 | %tmp2324 = zext i1 %tmp23 to i8 ; <i8> [#uses=1] |
| 65 | %toBool25 = icmp ne i8 %tmp2324, 0 ; <i1> [#uses=1] |
| 66 | br i1 %toBool25, label %cond_true26, label %cond_next27 |
| 67 | |
| 68 | cond_true26: ; preds = %bb17 |
| 69 | call void @abort( ) |
| 70 | unreachable |
| 71 | |
| 72 | cond_next27: ; preds = %bb17 |
| 73 | %tmp28 = load i32* %z16 ; <i32> [#uses=1] |
| 74 | %tmp29 = icmp ne i32 %tmp28, 0 ; <i1> [#uses=1] |
| 75 | %tmp2930 = zext i1 %tmp29 to i8 ; <i8> [#uses=1] |
| 76 | %toBool31 = icmp ne i8 %tmp2930, 0 ; <i1> [#uses=1] |
| 77 | br i1 %toBool31, label %bb17, label %bb32 |
| 78 | |
| 79 | bb32: ; preds = %cond_next27 |
| 80 | call void @exit( i32 0 ) |
| 81 | unreachable |
| 82 | |
| 83 | cond_false33: ; preds = %cond_false |
| 84 | call void @exit( i32 0 ) |
| 85 | unreachable |
| 86 | |
| 87 | cond_next34: ; No predecessors! |
| 88 | br label %cond_next35 |
| 89 | |
| 90 | cond_next35: ; preds = %cond_next34 |
| 91 | br label %return |
| 92 | |
| 93 | return: ; preds = %cond_next35 |
| 94 | %retval36 = load i32* %retval ; <i32> [#uses=1] |
| 95 | ret i32 %retval36 |
| 96 | } |
| 97 | |
| 98 | declare void @abort() |
| 99 | |
| 100 | declare void @exit(i32) |