1; RUN: llc -march=hexagon -O2 < %s | FileCheck %s 2 3define void @foo(i32 %n, i32* nocapture %A, i32* nocapture %B) nounwind optsize { 4entry: 5 %cmp = icmp sgt i32 %n, 100 6 br i1 %cmp, label %for.body.preheader, label %for.cond4.preheader 7 8; CHECK: endloop0 9; CHECK: endloop0 10; CHECK-NOT: endloop0 11 12for.body.preheader: 13 br label %for.body 14 15for.cond4.preheader: 16 %cmp113 = icmp sgt i32 %n, 0 17 br i1 %cmp113, label %for.body7.preheader, label %if.end 18 19for.body7.preheader: 20 br label %for.body7 21 22for.body: 23 %arrayidx.phi = phi i32* [ %arrayidx.inc, %for.body ], [ %B, %for.body.preheader ] 24 %arrayidx3.phi = phi i32* [ %arrayidx3.inc, %for.body ], [ %A, %for.body.preheader ] 25 %i.014 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ] 26 %0 = load i32, i32* %arrayidx.phi, align 4 27 %sub = add nsw i32 %0, -1 28 store i32 %sub, i32* %arrayidx3.phi, align 4 29 %inc = add nsw i32 %i.014, 1 30 %exitcond = icmp eq i32 %inc, %n 31 %arrayidx.inc = getelementptr i32, i32* %arrayidx.phi, i32 1 32 %arrayidx3.inc = getelementptr i32, i32* %arrayidx3.phi, i32 1 33 br i1 %exitcond, label %if.end.loopexit, label %for.body 34 35for.body7: 36 %arrayidx8.phi = phi i32* [ %arrayidx8.inc, %for.body7 ], [ %B, %for.body7.preheader ] 37 %arrayidx9.phi = phi i32* [ %arrayidx9.inc, %for.body7 ], [ %A, %for.body7.preheader ] 38 %i.117 = phi i32 [ %inc11, %for.body7 ], [ 0, %for.body7.preheader ] 39 %1 = load i32, i32* %arrayidx8.phi, align 4 40 %add = add nsw i32 %1, 1 41 store i32 %add, i32* %arrayidx9.phi, align 4 42 %inc11 = add nsw i32 %i.117, 1 43 %exitcond18 = icmp eq i32 %inc11, %n 44 %arrayidx8.inc = getelementptr i32, i32* %arrayidx8.phi, i32 1 45 %arrayidx9.inc = getelementptr i32, i32* %arrayidx9.phi, i32 1 46 br i1 %exitcond18, label %if.end.loopexit21, label %for.body7 47 48if.end.loopexit: 49 br label %if.end 50 51if.end.loopexit21: 52 br label %if.end 53 54if.end: 55 ret void 56} 57