1 ; RUN: opt -scalar-evolution -loop-deletion -simplifycfg -analyze -enable-new-pm=0 < %s | FileCheck %s --check-prefix=CHECK-ANALYSIS-1
2 ; RUN: opt "-passes=print<scalar-evolution>,loop(loop-deletion),simplifycfg" -disable-output < %s 2>&1 | FileCheck %s --check-prefix=CHECK-ANALYSIS-1
3 ; RUN: opt -analyze -enable-new-pm=0 -scalar-evolution < %s | FileCheck %s --check-prefix=CHECK-ANALYSIS-2
4 ; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s --check-prefix=CHECK-ANALYSIS-2
6 define i32 @pr34538() local_unnamed_addr #0 {
7 ; CHECK-ANALYSIS-1: Loop %do.body: backedge-taken count is 10000
8 ; CHECK-ANALYSIS-1: Loop %do.body: max backedge-taken count is 10000
9 ; CHECK-ANALYSIS-1: Loop %do.body: Predicated backedge-taken count is 10000
13 do.body: ; preds = %do.body, %entry
14 %start.0 = phi i32 [ 0, %entry ], [ %inc.start.0, %do.body ]
15 %cmp = icmp slt i32 %start.0, 10000
16 %inc = zext i1 %cmp to i32
17 %inc.start.0 = add nsw i32 %start.0, %inc
18 br i1 %cmp, label %do.body, label %do.end
20 do.end: ; preds = %do.body
29 do.body: ; preds = %do.body, %entry
30 %start.0 = phi i32 [ 0, %entry ], [ %inc.start.0, %do.body ]
31 %cmp = icmp slt i32 %start.0, 10000
32 %select_ext = select i1 %cmp, i32 2 , i32 1
33 %inc.start.0 = add nsw i32 %start.0, %select_ext
34 br i1 %cmp, label %do.body, label %do.end
36 do.end: ; preds = %do.body
38 ; CHECK-ANALYSIS-2: Loop %do.body: backedge-taken count is 5000
39 ; CHECK-ANALYSIS-2: Loop %do.body: max backedge-taken count is 5000
40 ; CHECK-ANALYSIS-2: Loop %do.body: Predicated backedge-taken count is 5000