loop-remarks.ll 963 B

12345678910111213141516171819202122232425
  1. ; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -unroll-count=16 2>&1 | FileCheck -check-prefix=COMPLETE-UNROLL %s
  2. ; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -unroll-count=4 2>&1 | FileCheck -check-prefix=PARTIAL-UNROLL %s
  3. ; COMPLETE-UNROLL: remark: {{.*}}: completely unrolled loop with 16 iterations
  4. ; PARTIAL-UNROLL: remark: {{.*}}: unrolled loop by a factor of 4
  5. define i32 @sum() {
  6. entry:
  7. br label %for.body
  8. for.body: ; preds = %for.body, %entry
  9. %s.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ]
  10. %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
  11. %add = add nsw i32 %i.05, 4
  12. %call = tail call i32 @baz(i32 %add) #2
  13. %add1 = add nsw i32 %call, %s.06
  14. %inc = add nsw i32 %i.05, 1
  15. %exitcond = icmp eq i32 %inc, 16
  16. br i1 %exitcond, label %for.end, label %for.body
  17. for.end: ; preds = %for.body
  18. ret i32 %add1
  19. }
  20. declare i32 @baz(i32)