1 ; RUN: llc < %s -mtriple=lanai | FileCheck %s
2 ; RUN: llc < %s -mtriple=lanai -disable-lanai-mem-alu-combiner | \
3 ; RUN: FileCheck %s -check-prefix=CHECK-DIS
6 ; CHECK: ld [%r{{[0-9]+}}++], %r{{[0-9]+}}{{$}}
7 ; CHECK-DIS-LABEL: sum,
10 define i32 @sum(ptr inreg nocapture readonly %data, i32 inreg %n) {
12 %cmp6 = icmp sgt i32 %n, 0
13 br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
15 for.body.preheader: ; preds = %entry
18 for.cond.cleanup.loopexit: ; preds = %for.body
19 %add.lcssa = phi i32 [ %add, %for.body ]
20 br label %for.cond.cleanup
22 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
23 %sum_.0.lcssa = phi i32 [ 0, %entry ], [ %add.lcssa, %for.cond.cleanup.loopexit ]
26 for.body: ; preds = %for.body.preheader, %for.body
27 %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
28 %sum_.07 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
29 %arrayidx = getelementptr inbounds i32, ptr %data, i32 %i.08
30 %0 = load i32, ptr %arrayidx, align 4
31 %add = add nsw i32 %0, %sum_.07
32 %inc = add nuw nsw i32 %i.08, 1
33 %exitcond = icmp eq i32 %inc, %n
34 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body