1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdeclare void @foo() 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workerdefine void @test1() nounwind { 6*9880d681SAndroid Build Coastguard Workerentry: 7*9880d681SAndroid Build Coastguard Worker br label %for.cond 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Workerfor.cond: ; preds = %if.end, %entry 10*9880d681SAndroid Build Coastguard Worker %i.0 = phi i32 [ 2, %entry ], [ %dec, %if.end ] 11*9880d681SAndroid Build Coastguard Worker switch i32 %i.0, label %if.end [ 12*9880d681SAndroid Build Coastguard Worker i32 0, label %for.end 13*9880d681SAndroid Build Coastguard Worker i32 1, label %if.then 14*9880d681SAndroid Build Coastguard Worker ] 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Workerif.then: ; preds = %for.cond 17*9880d681SAndroid Build Coastguard Worker tail call void @foo() 18*9880d681SAndroid Build Coastguard Worker br label %if.end 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Workerif.end: ; preds = %for.cond, %if.then 21*9880d681SAndroid Build Coastguard Worker %dec = add nsw i32 %i.0, -1 22*9880d681SAndroid Build Coastguard Worker br label %for.cond 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Workerfor.end: ; preds = %for.cond 25*9880d681SAndroid Build Coastguard Worker ret void 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test1 28*9880d681SAndroid Build Coastguard Worker; CHECK: Loop %for.cond: backedge-taken count is 2 29*9880d681SAndroid Build Coastguard Worker; CHECK: Loop %for.cond: max backedge-taken count is 2 30*9880d681SAndroid Build Coastguard Worker} 31