• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -loop-unroll -unroll-count=2 -S | FileCheck %s
2
3; LoopUnroll should unroll this loop into one big basic block.
4
5; CHECK: for.body:
6; CHECK: %i.013 = phi i64 [ 0, %entry ], [ %tmp16.1, %for.body ]
7; CHECK: br i1 %exitcond.1, label %for.end, label %for.body
8
9define void @foo(double* nocapture %p, i64 %n) nounwind {
10entry:
11  %mul10 = shl i64 %n, 1                          ; <i64> [#uses=2]
12  br label %for.body
13
14for.body:                                         ; preds = %entry, %for.body
15  %i.013 = phi i64 [ %tmp16, %for.body ], [ 0, %entry ] ; <i64> [#uses=2]
16  %arrayidx7 = getelementptr double, double* %p, i64 %i.013 ; <double*> [#uses=2]
17  %tmp16 = add i64 %i.013, 1                      ; <i64> [#uses=3]
18  %arrayidx = getelementptr double, double* %p, i64 %tmp16 ; <double*> [#uses=1]
19  %tmp4 = load double, double* %arrayidx                  ; <double> [#uses=1]
20  %tmp8 = load double, double* %arrayidx7                 ; <double> [#uses=1]
21  %mul9 = fmul double %tmp8, %tmp4                ; <double> [#uses=1]
22  store double %mul9, double* %arrayidx7
23  %exitcond = icmp eq i64 %tmp16, %mul10          ; <i1> [#uses=1]
24  br i1 %exitcond, label %for.end, label %for.body
25
26for.end:                                          ; preds = %for.body, %entry
27  ret void
28}
29