1 ; RUN: llc -march=hexagon -O2 < %s | FileCheck %s
3 define void @foo(i32 %n, ptr nocapture %A, ptr nocapture %B) nounwind optsize {
5 %cmp = icmp sgt i32 %n, 100
6 br i1 %cmp, label %for.body.preheader, label %for.cond4.preheader
16 %cmp113 = icmp sgt i32 %n, 0
17 br i1 %cmp113, label %for.body7.preheader, label %if.end
23 %arrayidx.phi = phi ptr [ %arrayidx.inc, %for.body ], [ %B, %for.body.preheader ]
24 %arrayidx3.phi = phi ptr [ %arrayidx3.inc, %for.body ], [ %A, %for.body.preheader ]
25 %i.014 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
26 %0 = load i32, ptr %arrayidx.phi, align 4
27 %sub = add nsw i32 %0, -1
28 store i32 %sub, ptr %arrayidx3.phi, align 4
29 %inc = add nsw i32 %i.014, 1
30 %exitcond = icmp eq i32 %inc, %n
31 %arrayidx.inc = getelementptr i32, ptr %arrayidx.phi, i32 1
32 %arrayidx3.inc = getelementptr i32, ptr %arrayidx3.phi, i32 1
33 br i1 %exitcond, label %if.end.loopexit, label %for.body
36 %arrayidx8.phi = phi ptr [ %arrayidx8.inc, %for.body7 ], [ %B, %for.body7.preheader ]
37 %arrayidx9.phi = phi ptr [ %arrayidx9.inc, %for.body7 ], [ %A, %for.body7.preheader ]
38 %i.117 = phi i32 [ %inc11, %for.body7 ], [ 0, %for.body7.preheader ]
39 %1 = load i32, ptr %arrayidx8.phi, align 4
40 %add = add nsw i32 %1, 1
41 store i32 %add, ptr %arrayidx9.phi, align 4
42 %inc11 = add nsw i32 %i.117, 1
43 %exitcond18 = icmp eq i32 %inc11, %n
44 %arrayidx8.inc = getelementptr i32, ptr %arrayidx8.phi, i32 1
45 %arrayidx9.inc = getelementptr i32, ptr %arrayidx9.phi, i32 1
46 br i1 %exitcond18, label %if.end.loopexit21, label %for.body7