Benjamin Kramer | 5a18854 | 2014-02-11 15:44:32 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s |
| 2 | |
| 3 | declare void @foo() |
| 4 | |
| 5 | define void @test1() nounwind { |
| 6 | entry: |
| 7 | br label %for.cond |
| 8 | |
| 9 | for.cond: ; preds = %if.end, %entry |
| 10 | %i.0 = phi i32 [ 2, %entry ], [ %dec, %if.end ] |
| 11 | switch i32 %i.0, label %if.end [ |
| 12 | i32 0, label %for.end |
| 13 | i32 1, label %if.then |
| 14 | ] |
| 15 | |
| 16 | if.then: ; preds = %for.cond |
| 17 | tail call void @foo() |
| 18 | br label %if.end |
| 19 | |
| 20 | if.end: ; preds = %for.cond, %if.then |
| 21 | %dec = add nsw i32 %i.0, -1 |
| 22 | br label %for.cond |
| 23 | |
| 24 | for.end: ; preds = %for.cond |
| 25 | ret void |
| 26 | |
| 27 | ; CHECK-LABEL: @test1 |
| 28 | ; CHECK: Loop %for.cond: backedge-taken count is 2 |
| 29 | ; CHECK: Loop %for.cond: max backedge-taken count is 2 |
| 30 | } |