1 ; RUN: opt -scalar-evolution -loop-deletion -simplifycfg -analyze < %s | FileCheck %s --check-prefix=CHECK-ANALYSIS-1
2 ; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s --check-prefix=CHECK-ANALYSIS-2
4 define i32 @pr34538() local_unnamed_addr #0 {
5 ; CHECK-ANALYSIS-1: Loop %do.body: backedge-taken count is 10000
6 ; CHECK-ANALYSIS-1: Loop %do.body: max backedge-taken count is 10000
7 ; CHECK-ANALYSIS-1: Loop %do.body: Predicated backedge-taken count is 10000
11 do.body: ; preds = %do.body, %entry
12 %start.0 = phi i32 [ 0, %entry ], [ %inc.start.0, %do.body ]
13 %cmp = icmp slt i32 %start.0, 10000
14 %inc = zext i1 %cmp to i32
15 %inc.start.0 = add nsw i32 %start.0, %inc
16 br i1 %cmp, label %do.body, label %do.end
18 do.end: ; preds = %do.body
27 do.body: ; preds = %do.body, %entry
28 %start.0 = phi i32 [ 0, %entry ], [ %inc.start.0, %do.body ]
29 %cmp = icmp slt i32 %start.0, 10000
30 %select_ext = select i1 %cmp, i32 2 , i32 1
31 %inc.start.0 = add nsw i32 %start.0, %select_ext
32 br i1 %cmp, label %do.body, label %do.end
34 do.end: ; preds = %do.body
36 ; CHECK-ANALYSIS-2: Loop %do.body: backedge-taken count is 5000
37 ; CHECK-ANALYSIS-2: Loop %do.body: max backedge-taken count is 5000
38 ; CHECK-ANALYSIS-2: Loop %do.body: Predicated backedge-taken count is 5000