1; RUN: opt %loadPolly -polly-allow-differing-element-types -polly-scops -analyze < %s | FileCheck %s
2; RUN: opt %loadPolly -S -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:    }
7; CHECK:         Statements {
8; CHECK-NEXT:       Stmt_for_body3
9; CHECK-NEXT:            Domain :=
10; CHECK-NEXT:                { Stmt_for_body3[i0, i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023 };
11; CHECK-NEXT:            Schedule :=
12; CHECK-NEXT:                { Stmt_for_body3[i0, i1] -> [i0, i1] };
13; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
14; CHECK-NEXT:                { Stmt_for_body3[i0, i1] -> MemRef_A[o0] : 0 <= o0 <= 186 };
15;
16; IR:   %[[r1:[a-zA-Z0-9]*]] = bitcast i32* %A to i8*
17;
18; IR: polly.stmt.for.body3:
19; IR:   call void @llvm.memset.p0i8.i64(i8* align 4 %[[r1]], i8 36, i64 187, i1 false)
20;
21;    #include <string.h>
22;
23;    void jd(int *A) {
24;      for (int i = 0; i < 1024; i++)
25;        for (int j = 0; j < 1024; j++)
26;          memset(A, '$', 187);
27;    }
28;
29target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
30
31define void @jd(i32* noalias %A) {
32entry:
33  br label %for.cond
34
35for.cond:                                         ; preds = %for.inc4, %entry
36  %i.0 = phi i32 [ 0, %entry ], [ %inc5, %for.inc4 ]
37  %exitcond1 = icmp ne i32 %i.0, 1024
38  br i1 %exitcond1, label %for.body, label %for.end6
39
40for.body:                                         ; preds = %for.cond
41  br label %for.cond1
42
43for.cond1:                                        ; preds = %for.inc, %for.body
44  %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
45  %exitcond = icmp ne i32 %j.0, 1024
46  br i1 %exitcond, label %for.body3, label %for.end
47
48for.body3:                                        ; preds = %for.cond1
49  %tmp = bitcast i32* %A to i8*
50  call void @llvm.memset.p0i8.i64(i8* %tmp, i8 36, i64 187, i32 4, i1 false)
51  br label %for.inc
52
53for.inc:                                          ; preds = %for.body3
54  %inc = add nsw i32 %j.0, 1
55  br label %for.cond1
56
57for.end:                                          ; preds = %for.cond1
58  br label %for.inc4
59
60for.inc4:                                         ; preds = %for.end
61  %inc5 = add nsw i32 %i.0, 1
62  br label %for.cond
63
64for.end6:                                         ; preds = %for.cond
65  ret void
66}
67
68declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #1
69
70