exit_value_test3.ll 830 B

123456789101112131415161718192021222324
  1. ; RUN: opt < %s -indvars -loop-deletion -S |FileCheck %s
  2. ; Check IndVarSimplify should replace exit value even if the expansion cost
  3. ; is high because the loop can be deleted after the exit value rewrite.
  4. ;
  5. ; CHECK-LABEL: @_Z3fooPKcjj(
  6. ; CHECK: udiv
  7. ; CHECK: [[LABEL:^[a-zA-Z0-9_.]+]]:
  8. ; CHECK-NOT: br {{.*}} [[LABEL]]
  9. define i32 @_Z3fooPKcjj(i8* nocapture readnone %s, i32 %len, i32 %c) #0 {
  10. entry:
  11. br label %while.cond
  12. while.cond: ; preds = %while.cond, %entry
  13. %klen.0 = phi i32 [ %len, %entry ], [ %sub, %while.cond ]
  14. %cmp = icmp ugt i32 %klen.0, 11
  15. %sub = add i32 %klen.0, -12
  16. br i1 %cmp, label %while.cond, label %while.end
  17. while.end: ; preds = %while.cond
  18. %klen.0.lcssa = phi i32 [ %klen.0, %while.cond ]
  19. ret i32 %klen.0.lcssa
  20. }