1; RUN: opt %loadPolly -basic-aa -polly-allow-differing-element-types -polly-scops -analyze < %s | FileCheck %s
2; RUN: opt %loadPolly -S -basic-aa -polly-allow-differing-element-types -polly-codegen < %s | FileCheck --check-prefix=IR %s
3;
4; CHECK:         Arrays {
5; CHECK-NEXT:        i8 MemRef_A[*]; // Element size 1
6; CHECK-NEXT:        i8 MemRef_B[*]; // Element size 1
7; CHECK-NEXT:    }
8; CHECK:         Statements {
9; CHECK-NEXT:       Stmt_for_body3
10; CHECK-NEXT:            Domain :=
11; CHECK-NEXT:                { Stmt_for_body3[i0, i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023 };
12; CHECK-NEXT:            Schedule :=
13; CHECK-NEXT:                { Stmt_for_body3[i0, i1] -> [i0, i1] };
14; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
15; CHECK-NEXT:                { Stmt_for_body3[i0, i1] -> MemRef_A[o0] : -16 <= o0 <= 15 };
16; CHECK-NEXT:            ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
17; CHECK-NEXT:                { Stmt_for_body3[i0, i1] -> MemRef_B[o0] : 64 <= o0 <= 95 };
18;
19; IR: polly.loop_preheader:
20; IR:   %[[r1:[a-zA-Z0-9]*]] = getelementptr i32, i32* %A, i64 -4
21; IR:   %[[r2:[a-zA-Z0-9]*]] = bitcast i32* %scevgep to i8*
22; IR:   %[[r3:[a-zA-Z0-9]*]] = getelementptr i64, i64* %B, i64 8
23; IR:   %[[r4:[a-zA-Z0-9]*]] = bitcast i64* %scevgep8 to i8*
24;
25; IR: polly.stmt.for.body3:
26; IR:   call void @llvm.memmove.p0i8.p0i8.i64(i8* align 4 %[[r2]], i8* align 4 %[[r4]], i64 32, i1 false)
27;
28;    #include <string.h>
29;
30;    void jd(int *restrict A, long *restrict B) {
31;      for (int i = 0; i < 1024; i++)
32;        for (int j = 0; j < 1024; j++)
33;          memmove(A - 4, B + 8, 32);
34;    }
35;
36target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
37
38define void @jd(i32* noalias %A, i64* noalias %B) {
39entry:
40  br label %for.cond
41
42for.cond:                                         ; preds = %for.inc5, %entry
43  %i.0 = phi i32 [ 0, %entry ], [ %inc6, %for.inc5 ]
44  %exitcond1 = icmp ne i32 %i.0, 1024
45  br i1 %exitcond1, label %for.body, label %for.end7
46
47for.body:                                         ; preds = %for.cond
48  br label %for.cond1
49
50for.cond1:                                        ; preds = %for.inc, %for.body
51  %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
52  %exitcond = icmp ne i32 %j.0, 1024
53  br i1 %exitcond, label %for.body3, label %for.end
54
55for.body3:                                        ; preds = %for.cond1
56  %add.ptr = getelementptr inbounds i32, i32* %A, i64 -4
57  %tmp = bitcast i32* %add.ptr to i8*
58  %add.ptr4 = getelementptr inbounds i64, i64* %B, i64 8
59  %tmp2 = bitcast i64* %add.ptr4 to i8*
60  call void @llvm.memmove.p0i8.p0i8.i64(i8* %tmp, i8* %tmp2, i64 32, i32 4, i1 false)
61  br label %for.inc
62
63for.inc:                                          ; preds = %for.body3
64  %inc = add nsw i32 %j.0, 1
65  br label %for.cond1
66
67for.end:                                          ; preds = %for.cond1
68  br label %for.inc5
69
70for.inc5:                                         ; preds = %for.end
71  %inc6 = add nsw i32 %i.0, 1
72  br label %for.cond
73
74for.end7:                                         ; preds = %for.cond
75  ret void
76}
77
78declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1
79
80