blob: 2d2b6b4994089dc587a512d89b0bc8cca9b1feb0 [file] [log] [blame]
Benjamin Kramer5a188542014-02-11 15:44:32 +00001; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
2
3declare void @foo()
4
5define void @test1() nounwind {
6entry:
7 br label %for.cond
8
9for.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
16if.then: ; preds = %for.cond
17 tail call void @foo()
18 br label %if.end
19
20if.end: ; preds = %for.cond, %if.then
21 %dec = add nsw i32 %i.0, -1
22 br label %for.cond
23
24for.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}