29 lines · plain
1; RUN: opt < %s -passes=loop-deletion -S | FileCheck %s2; RUN: opt < %s -passes='loop(loop-deletion)' -S | FileCheck %s3 4; ScalarEvolution can prove the loop iteration is finite, even though5; it can't represent the exact trip count as an expression. That's6; good enough to let the loop be deleted.7 8; CHECK: entry:9; CHECK-NEXT: br label %return10 11; CHECK: return:12; CHECK-NEXT: ret void13 14define void @foo(i64 %n, i64 %m) nounwind {15entry:16 br label %bb17 18bb:19 %x.0 = phi i64 [ 0, %entry ], [ %t0, %bb ]20 %t0 = add i64 %x.0, 121 %t1 = icmp slt i64 %x.0, %n22 %t3 = icmp sgt i64 %x.0, %m23 %t4 = and i1 %t1, %t324 br i1 %t4, label %bb, label %return25 26return:27 ret void28}29