1 ; Check for recognizing the "memmove" idiom. 2 ; RUN: opt -basicaa -hexagon-loop-idiom -S -mtriple hexagon-unknown-elf < %s \ 3 ; RUN: | FileCheck %s 4 ; CHECK: call void @llvm.memmove 5 6 ; Function Attrs: norecurse nounwind 7 define void @foo(i32* nocapture %A, i32* nocapture readonly %B, i32 %n) #0 { 8 entry: 9 %cmp1 = icmp sgt i32 %n, 0 10 br i1 %cmp1, label %for.body.preheader, label %for.end 11 12 for.body.preheader: ; preds = %entry 13 %arrayidx.gep = getelementptr i32, i32* %B, i32 0 14 %arrayidx1.gep = getelementptr i32, i32* %A, i32 0 15 br label %for.body 16 17 for.body: ; preds = %for.body.preheader, %for.body 18 %arrayidx.phi = phi i32* [ %arrayidx.gep, %for.body.preheader ], [ %arrayidx.inc, %for.body ] 19 %arrayidx1.phi = phi i32* [ %arrayidx1.gep, %for.body.preheader ], [ %arrayidx1.inc, %for.body ] 20 %i.02 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ] 21 %0 = load i32, i32* %arrayidx.phi, align 4 22 store i32 %0, i32* %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, i32* %arrayidx.phi, i32 1 26 %arrayidx1.inc = getelementptr i32, i32* %arrayidx1.phi, i32 1 27 br i1 %exitcond, label %for.body, label %for.end.loopexit 28 29 for.end.loopexit: ; preds = %for.body 30 br label %for.end 31 32 for.end: ; preds = %for.end.loopexit, %entry 33 ret void 34 } 35 36 attributes #0 = { nounwind } 37