• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7define i32 @sum() {
8entry:
9  br label %for.body
10
11for.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
21for.end:                                          ; preds = %for.body
22  ret i32 %add1
23}
24
25declare i32 @baz(i32)
26