• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -basicaa -hexagon-loop-idiom -S -mtriple hexagon-unknown-elf < %s \
2; RUN:  | FileCheck %s
3
4define void @PR14241(i32* %s, i64 %size) #0 {
5; Ensure that we don't form a memcpy for strided loops. Briefly, when we taught
6; LoopIdiom about memmove and strided loops, this got miscompiled into a memcpy
7; instead of a memmove. If we get the memmove transform back, this will catch
8; regressions.
9;
10; CHECK-LABEL: @PR14241(
11
12entry:
13  %end.idx = add i64 %size, -1
14  %end.ptr = getelementptr inbounds i32, i32* %s, i64 %end.idx
15  br label %while.body
16; CHECK-NOT: memcpy
17; CHECK: memmove
18
19while.body:
20  %phi.ptr = phi i32* [ %s, %entry ], [ %next.ptr, %while.body ]
21  %src.ptr = getelementptr inbounds i32, i32* %phi.ptr, i64 1
22  %val = load i32, i32* %src.ptr, align 4
23; CHECK: load
24  %dst.ptr = getelementptr inbounds i32, i32* %phi.ptr, i64 0
25  store i32 %val, i32* %dst.ptr, align 4
26; CHECK: store
27  %next.ptr = getelementptr inbounds i32, i32* %phi.ptr, i64 1
28  %cmp = icmp eq i32* %next.ptr, %end.ptr
29  br i1 %cmp, label %exit, label %while.body
30
31exit:
32  ret void
33; CHECK: ret void
34}
35
36attributes #0 = { nounwind }
37