1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=print<polly-function-scops>' -pass-remarks-analysis="polly-scops" \
2; RUN:     -polly-allow-differing-element-types \
3; RUN:     -disable-output < %s  2>&1 | FileCheck %s
4;
5;    // For the following accesses the offset expression from the base pointer
6;    // is not always a multiple of the type size.
7;    void multiple_types(char *Short, char *Float, char *Double) {
8;      for (long i = 0; i < 100; i++) {
9;        Short[i] = *(short *)&Short[i];
10;        Float[i] = *(float *)&Float[i];
11;        Double[i] = *(double *)&Double[i];
12;      }
13;    }
14;
15; CHECK:    Arrays {
16; CHECK:        i8 MemRef_Short[*]; // Element size 1
17; CHECK:        i8 MemRef_Float[*]; // Element size 1
18; CHECK:        i8 MemRef_Double[*]; // Element size 1
19; CHECK:    }
20; CHECK:    Arrays (Bounds as pw_affs) {
21; CHECK:        i8 MemRef_Short[*]; // Element size 1
22; CHECK:        i8 MemRef_Float[*]; // Element size 1
23; CHECK:        i8 MemRef_Double[*]; // Element size 1
24; CHECK:    }
25; CHECK:    Statements {
26; CHECK:      Stmt_bb2
27; CHECK:            Domain :=
28; CHECK:                { Stmt_bb2[i0] : 0 <= i0 <= 99 };
29; CHECK:            Schedule :=
30; CHECK:                { Stmt_bb2[i0] -> [i0] };
31; CHECK:            ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
32; CHECK:                { Stmt_bb2[i0] -> MemRef_Short[o0] : i0 <= o0 <= 1 + i0 };
33; CHECK:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
34; CHECK:                { Stmt_bb2[i0] -> MemRef_Short[i0] };
35; CHECK:            ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
36; CHECK:                { Stmt_bb2[i0] -> MemRef_Float[o0] : i0 <= o0 <= 3 + i0 };
37; CHECK:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
38; CHECK:                { Stmt_bb2[i0] -> MemRef_Float[i0] };
39; CHECK:            ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
40; CHECK:                { Stmt_bb2[i0] -> MemRef_Double[o0] : i0 <= o0 <= 7 + i0 };
41; CHECK:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
42; CHECK:                { Stmt_bb2[i0] -> MemRef_Double[i0] };
43; CHECK:    }
44
45target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
46
47define void @multiple_types(ptr %Short, ptr %Float, ptr %Double) {
48bb:
49  br label %bb1
50
51bb1:                                              ; preds = %bb17, %bb
52  %i.0 = phi i64 [ 0, %bb ], [ %tmp18, %bb17 ]
53  %exitcond = icmp ne i64 %i.0, 100
54  br i1 %exitcond, label %bb2, label %bb19
55
56bb2:                                              ; preds = %bb1
57  %tmp = getelementptr inbounds i8, ptr %Short, i64 %i.0
58  %tmp4 = load i16, ptr %tmp, align 1
59  %tmp5 = trunc i16 %tmp4 to i8
60  %tmp6 = getelementptr inbounds i8, ptr %Short, i64 %i.0
61  store i8 %tmp5, ptr %tmp6, align 1
62  %tmp7 = getelementptr inbounds i8, ptr %Float, i64 %i.0
63  %tmp9 = load float, ptr %tmp7, align 1
64  %tmp10 = fptosi float %tmp9 to i8
65  %tmp11 = getelementptr inbounds i8, ptr %Float, i64 %i.0
66  store i8 %tmp10, ptr %tmp11, align 1
67  %tmp12 = getelementptr inbounds i8, ptr %Double, i64 %i.0
68  %tmp14 = load double, ptr %tmp12, align 1
69  %tmp15 = fptosi double %tmp14 to i8
70  %tmp16 = getelementptr inbounds i8, ptr %Double, i64 %i.0
71  store i8 %tmp15, ptr %tmp16, align 1
72  br label %bb17
73
74bb17:                                             ; preds = %bb2
75  %tmp18 = add nuw nsw i64 %i.0, 1
76  br label %bb1
77
78bb19:                                             ; preds = %bb1
79  ret void
80}
81