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 3 4define 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 8entry: 9 br label %do.body 10 11do.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 17 18do.end: ; preds = %do.body 19 ret i32 0 20} 21 22 23define i32 @foo() { 24entry: 25 br label %do.body 26 27do.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 33 34do.end: ; preds = %do.body 35 ret i32 0 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 39} 40