1 ; RUN: llc -march=hexagon -disable-machine-licm -hwloop-spec-preheader=1 < %s | FileCheck %s
4 target triple = "hexagon"
6 define i32 @foo(i32 %x, i32 %n, ptr nocapture %A, ptr nocapture %B) #0 {
8 %cmp = icmp sgt i32 %x, 0
9 br i1 %cmp, label %for.cond.preheader, label %return
11 for.cond.preheader: ; preds = %entry
12 %cmp16 = icmp sgt i32 %n, 0
13 br i1 %cmp16, label %for.body.preheader, label %return
15 for.body.preheader: ; preds = %for.cond.preheader
18 for.body: ; preds = %for.body.preheader, %for.body
19 %arrayidx.phi = phi ptr [ %arrayidx.inc, %for.body ], [ %B, %for.body.preheader ]
20 %arrayidx2.phi = phi ptr [ %arrayidx2.inc, %for.body ], [ %A, %for.body.preheader ]
21 %i.07 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
22 %0 = load i32, ptr %arrayidx.phi, align 4, !tbaa !0
23 %1 = load i32, ptr %arrayidx2.phi, align 4, !tbaa !0
24 %add = add nsw i32 %1, %0
25 store i32 %add, ptr %arrayidx2.phi, align 4, !tbaa !0
26 %inc = add nsw i32 %i.07, 1
27 %exitcond = icmp eq i32 %inc, %n
28 %arrayidx.inc = getelementptr i32, ptr %arrayidx.phi, i32 1
29 %arrayidx2.inc = getelementptr i32, ptr %arrayidx2.phi, i32 1
30 br i1 %exitcond, label %return.loopexit, label %for.body
32 return.loopexit: ; preds = %for.body
35 return: ; preds = %return.loopexit, %for.cond.preheader, %entry
36 %retval.0 = phi i32 [ 2, %entry ], [ 0, %for.cond.preheader ], [ 0, %return.loopexit ]
41 !1 = !{!"omnipotent char", !2}
42 !2 = !{!"Simple C/C++ TBAA"}
44 attributes #0 = { nounwind "target-cpu"="hexagonv60" "target-features"="-hvx" }