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