Fix Polly
[polly-mirror.git] / test / ScopInfo / multiple-types.ll
blob813cce03823905022e4746777744b68c1ebab353
1 ; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-scops -analyze \
2 ; RUN: -polly-allow-differing-element-types < %s | FileCheck %s
4 ;    // Check that accessing one array with different types works.
5 ;    void multiple_types(char *Short, char *Float, char *Double) {
6 ;      for (long i = 0; i < 100; i++) {
7 ;        Short[i] = *(short *)&Short[2 * i];
8 ;        Float[i] = *(float *)&Float[4 * i];
9 ;        Double[i] = *(double *)&Double[8 * i];
10 ;      }
11 ;    }
13 ; CHECK: Statements {
14 ; CHECK-NEXT: Stmt_bb2
15 ; CHECK-NEXT: Domain :=
16 ; CHECK-NEXT:     { Stmt_bb2[i0] : 0 <= i0 <= 99 };
17 ; CHECK-NEXT: Schedule :=
18 ; CHECK-NEXT:     { Stmt_bb2[i0] -> [i0] };
19 ; CHECK-NEXT: ReadAccess :=       [Reduction Type: NONE] [Scalar: 0]
20 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Short[o0] : 2i0 <= o0 <= 1 + 2i0 };
21 ; CHECK-NEXT: MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
22 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Short[i0] };
23 ; CHECK-NEXT: ReadAccess :=       [Reduction Type: NONE] [Scalar: 0]
24 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Float[o0] : 4i0 <= o0 <= 3 + 4i0 };
25 ; CHECK-NEXT: MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
26 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Float[i0] };
27 ; CHECK-NEXT: ReadAccess :=       [Reduction Type: NONE] [Scalar: 0]
28 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Double[o0] : 8i0 <= o0 <= 7 + 8i0 };
29 ; CHECK-NEXT: MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
30 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Double[i0] };
31 ; CHECK-NEXT: }
33 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
35 define void @multiple_types(i8* %Short, i8* %Float, i8* %Double) {
36 bb:
37   br label %bb1
39 bb1:                                              ; preds = %bb20, %bb
40   %i.0 = phi i64 [ 0, %bb ], [ %tmp21, %bb20 ]
41   %exitcond = icmp ne i64 %i.0, 100
42   br i1 %exitcond, label %bb2, label %bb22
44 bb2:                                              ; preds = %bb1
45   %tmp = shl nsw i64 %i.0, 1
46   %tmp3 = getelementptr inbounds i8, i8* %Short, i64 %tmp
47   %tmp4 = bitcast i8* %tmp3 to i16*
48   %tmp5 = load i16, i16* %tmp4, align 2
49   %tmp6 = trunc i16 %tmp5 to i8
50   %tmp7 = getelementptr inbounds i8, i8* %Short, i64 %i.0
51   store i8 %tmp6, i8* %tmp7, align 1
52   %tmp8 = shl nsw i64 %i.0, 2
53   %tmp9 = getelementptr inbounds i8, i8* %Float, i64 %tmp8
54   %tmp10 = bitcast i8* %tmp9 to float*
55   %tmp11 = load float, float* %tmp10, align 4
56   %tmp12 = fptosi float %tmp11 to i8
57   %tmp13 = getelementptr inbounds i8, i8* %Float, i64 %i.0
58   store i8 %tmp12, i8* %tmp13, align 1
59   %tmp14 = shl nsw i64 %i.0, 3
60   %tmp15 = getelementptr inbounds i8, i8* %Double, i64 %tmp14
61   %tmp16 = bitcast i8* %tmp15 to double*
62   %tmp17 = load double, double* %tmp16, align 8
63   %tmp18 = fptosi double %tmp17 to i8
64   %tmp19 = getelementptr inbounds i8, i8* %Double, i64 %i.0
65   store i8 %tmp18, i8* %tmp19, align 1
66   br label %bb20
68 bb20:                                             ; preds = %bb2
69   %tmp21 = add nuw nsw i64 %i.0, 1
70   br label %bb1
72 bb22:                                             ; preds = %bb1
73   ret void