multiple-exit-conditions.ll 617 B

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