OLD | NEW |
(Empty) | |
| 1 ; RUIN: %llvm2ice -verbose inst %s | FileCheck %s |
| 2 ; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 3 ; RUN: %szdiff --llvm2ice=%llvm2ice %s | FileCheck --check-prefix=DUMP %s |
| 4 |
| 5 define i32 @fib(i32 %n) { |
| 6 ; CHECK: define i32 @fib |
| 7 entry: |
| 8 %cmp = icmp slt i32 %n, 2 |
| 9 br i1 %cmp, label %return, label %if.end |
| 10 |
| 11 if.end: ; preds = %entry |
| 12 %sub = add i32 %n, -1 |
| 13 %call = tail call i32 @fib(i32 %sub) |
| 14 %sub1 = add i32 %n, -2 |
| 15 %call2 = tail call i32 @fib(i32 %sub1) |
| 16 %add = add i32 %call2, %call |
| 17 ret i32 %add |
| 18 |
| 19 return: ; preds = %entry |
| 20 ret i32 %n |
| 21 } |
| 22 |
| 23 define i32 @fact(i32 %n) { |
| 24 ; CHECK: define i32 @fact |
| 25 entry: |
| 26 %cmp = icmp slt i32 %n, 2 |
| 27 br i1 %cmp, label %return, label %if.end |
| 28 |
| 29 if.end: ; preds = %entry |
| 30 %sub = add i32 %n, -1 |
| 31 %call = tail call i32 @fact(i32 %sub) |
| 32 %mul = mul i32 %call, %n |
| 33 ret i32 %mul |
| 34 |
| 35 return: ; preds = %entry |
| 36 ret i32 %n |
| 37 } |
| 38 |
| 39 define i32 @redirect(i32 %n) { |
| 40 ; CHECK: define i32 @redirect |
| 41 entry: |
| 42 %call = tail call i32 @redirect_target(i32 %n) |
| 43 ret i32 %call |
| 44 } |
| 45 |
| 46 declare i32 @redirect_target(i32) |
| 47 |
| 48 define void @call_void(i32 %n) { |
| 49 ; CHECK: define void @call_void |
| 50 entry: |
| 51 %cmp2 = icmp sgt i32 %n, 0 |
| 52 br i1 %cmp2, label %if.then, label %if.end |
| 53 |
| 54 if.then: ; preds = %entry, %if.then |
| 55 %n.tr3 = phi i32 [ %call.i, %if.then ], [ %n, %entry ] |
| 56 %sub = add i32 %n.tr3, -1 |
| 57 %call.i = tail call i32 @redirect_target(i32 %sub) |
| 58 %cmp = icmp sgt i32 %call.i, 0 |
| 59 br i1 %cmp, label %if.then, label %if.end |
| 60 |
| 61 if.end: ; preds = %if.then, %entry |
| 62 ret void |
| 63 } |
| 64 |
| 65 ; ERRORS-NOT: ICE translation error |
| 66 ; DUMP-NOT: SZ |
OLD | NEW |