Diego Novillo | cd64780 | 2014-04-29 20:06:10 +0000 | [diff] [blame] | 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 | |
| 4 | ; COMPLETE-UNROLL: remark: {{.*}}: completely unrolled loop with 16 iterations |
| 5 | ; PARTIAL-UNROLL: remark: {{.*}}: unrolled loop by a factor of 4 |
| 6 | |
| 7 | define i32 @sum() { |
| 8 | entry: |
| 9 | br label %for.body |
| 10 | |
| 11 | for.body: ; preds = %for.body, %entry |
| 12 | %s.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ] |
| 13 | %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ] |
| 14 | %add = add nsw i32 %i.05, 4 |
| 15 | %call = tail call i32 @baz(i32 %add) #2 |
| 16 | %add1 = add nsw i32 %call, %s.06 |
| 17 | %inc = add nsw i32 %i.05, 1 |
| 18 | %exitcond = icmp eq i32 %inc, 16 |
| 19 | br i1 %exitcond, label %for.end, label %for.body |
| 20 | |
| 21 | for.end: ; preds = %for.body |
| 22 | ret i32 %add1 |
| 23 | } |
| 24 | |
| 25 | declare i32 @baz(i32) |