1 ; RUN: llc -march=hexagon -mcpu=hexagonv5 -enable-pipeliner < %s -pipeliner-experimental-cg=true | FileCheck %s
3 ; Make sure we attempt to pipeline all inner most loops.
5 ; Check if the first loop is pipelined.
6 ; CHECK: loop0(.LBB0_[[LOOP:.]],
7 ; CHECK: .LBB0_[[LOOP]]:
8 ; CHECK: add(r{{[0-9]+}},r{{[0-9]+}})
9 ; CHECK-NEXT: memw(r{{[0-9]+}}++#4)
10 ; CHECK-NEXT: endloop0
12 ; Check if the second loop is pipelined.
13 ; CHECK: loop0(.LBB0_[[LOOP:.]],
14 ; CHECK: .LBB0_[[LOOP]]:
15 ; CHECK: add(r{{[0-9]+}},r{{[0-9]+}})
16 ; CHECK-NEXT: memw(r{{[0-9]+}}++#4)
17 ; CHECK-NEXT: endloop0
19 define i32 @test(ptr %a, i32 %n, i32 %l) {
21 %cmp23 = icmp sgt i32 %n, 0
22 br i1 %cmp23, label %for.body3.lr.ph.preheader, label %for.end14
24 for.body3.lr.ph.preheader:
25 br label %for.body3.lr.ph
28 %sum1.026 = phi i32 [ %add8, %for.inc12 ], [ 0, %for.body3.lr.ph.preheader ]
29 %sum.025 = phi i32 [ %add, %for.inc12 ], [ 0, %for.body3.lr.ph.preheader ]
30 %j.024 = phi i32 [ %inc13, %for.inc12 ], [ 0, %for.body3.lr.ph.preheader ]
34 %sum.118 = phi i32 [ %sum.025, %for.body3.lr.ph ], [ %add, %for.body3 ]
35 %arrayidx.phi = phi ptr [ %a, %for.body3.lr.ph ], [ %arrayidx.inc, %for.body3 ]
36 %i.017 = phi i32 [ 0, %for.body3.lr.ph ], [ %inc, %for.body3 ]
37 %0 = load i32, ptr %arrayidx.phi, align 4
38 %add = add nsw i32 %0, %sum.118
39 %inc = add nsw i32 %i.017, 1
40 %exitcond = icmp eq i32 %inc, %n
41 %arrayidx.inc = getelementptr i32, ptr %arrayidx.phi, i32 1
42 br i1 %exitcond, label %for.end, label %for.body3
45 tail call void @bar(ptr %a) #2
49 %sum1.121 = phi i32 [ %sum1.026, %for.end ], [ %add8, %for.body6 ]
50 %arrayidx7.phi = phi ptr [ %a, %for.end ], [ %arrayidx7.inc, %for.body6 ]
51 %i.120 = phi i32 [ 0, %for.end ], [ %inc10, %for.body6 ]
52 %1 = load i32, ptr %arrayidx7.phi, align 4
53 %add8 = add nsw i32 %1, %sum1.121
54 %inc10 = add nsw i32 %i.120, 1
55 %exitcond29 = icmp eq i32 %inc10, %n
56 %arrayidx7.inc = getelementptr i32, ptr %arrayidx7.phi, i32 1
57 br i1 %exitcond29, label %for.inc12, label %for.body6
60 %inc13 = add nsw i32 %j.024, 1
61 %exitcond30 = icmp eq i32 %inc13, %n
62 br i1 %exitcond30, label %for.end14.loopexit, label %for.body3.lr.ph
68 %sum1.0.lcssa = phi i32 [ 0, %entry ], [ %add8, %for.end14.loopexit ]
69 %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.end14.loopexit ]
70 %add15 = add nsw i32 %sum1.0.lcssa, %sum.0.lcssa
74 declare void @bar(ptr)