1; RUN: opt < %s -loop-deletion -S | FileCheck %s 2; RUN: opt < %s -passes='require<scalar-evolution>,loop(loop-deletion)' -S | FileCheck %s 3 4; ScalarEvolution can prove the loop iteration is finite, even though 5; it can't represent the exact trip count as an expression. That's 6; good enough to let the loop be deleted. 7 8; CHECK: entry: 9; CHECK-NEXT: br label %return 10 11; CHECK: return: 12; CHECK-NEXT: ret void 13 14define void @foo(i64 %n, i64 %m) nounwind { 15entry: 16 br label %bb 17 18bb: 19 %x.0 = phi i64 [ 0, %entry ], [ %t0, %bb ] 20 %t0 = add i64 %x.0, 1 21 %t1 = icmp slt i64 %x.0, %n 22 %t3 = icmp sgt i64 %x.0, %m 23 %t4 = and i1 %t1, %t3 24 br i1 %t4, label %bb, label %return 25 26return: 27 ret void 28} 29