1 ; Check for recognizing the "memmove" idiom.
2 ; RUN: opt -hexagon-loop-idiom -S -mtriple hexagon-unknown-elf < %s \
4 ; CHECK: call void @llvm.memmove
6 ; Function Attrs: norecurse nounwind
7 define void @foo(ptr nocapture %A, ptr nocapture readonly %B, i32 %n) #0 {
9 %cmp1 = icmp sgt i32 %n, 0
10 br i1 %cmp1, label %for.body.preheader, label %for.end
12 for.body.preheader: ; preds = %entry
15 for.body: ; preds = %for.body.preheader, %for.body
16 %arrayidx.phi = phi ptr [ %B, %for.body.preheader ], [ %arrayidx.inc, %for.body ]
17 %arrayidx1.phi = phi ptr [ %A, %for.body.preheader ], [ %arrayidx1.inc, %for.body ]
18 %i.02 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
19 %0 = load i32, ptr %arrayidx.phi, align 4
20 store i32 %0, ptr %arrayidx1.phi, align 4
21 %inc = add nuw nsw i32 %i.02, 1
22 %exitcond = icmp ne i32 %inc, %n
23 %arrayidx.inc = getelementptr i32, ptr %arrayidx.phi, i32 1
24 %arrayidx1.inc = getelementptr i32, ptr %arrayidx1.phi, i32 1
25 br i1 %exitcond, label %for.body, label %for.end.loopexit
27 for.end.loopexit: ; preds = %for.body
30 for.end: ; preds = %for.end.loopexit, %entry
34 attributes #0 = { nounwind }