Fix Polly
[polly-mirror.git] / test / MaximalStaticExpansion / working_value_expansion.ll
blob71a355f329e90699a72d881f97b665cfbf79935b
1 ; RUN: opt %loadPolly -polly-mse -analyze < %s | FileCheck %s
3 ; Verify that the accesses are correctly expanded for MemoryKind::Value
5 ; Original source code :
7 ; #define Ni 10000
8 ; #define Nj 10000
10 ; void mse(double A[Ni], double B[Nj]) {
11 ;   int i,j;
12 ;   double tmp = 6;
13 ;   for (i = 0; i < Ni; i++) {
14 ;     tmp = i;
15 ;     for (int j = 0; j<Nj; j++) {
16 ;       A[j] = tmp+3;
17 ;     }
18 ;     B[i] = tmp;
19 ;   }
20 ; }
22 ; Check if the expanded SAI are created
24 ; CHECK: double MemRef_conv_Stmt_for_body_expanded[10000]; // Element size 8
26 ; Check if the memory accesses are modified
28 ; CHECK: new: { Stmt_for_body[i0] -> MemRef_conv_Stmt_for_body_expanded[i0] };
29 ; CHECK: new: { Stmt_for_body5[i0, i1] -> MemRef_conv_Stmt_for_body_expanded[i0] };
30 ; CHECK: new: { Stmt_for_end[i0] -> MemRef_conv_Stmt_for_body_expanded[i0] };
32 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
33 target triple = "x86_64-unknown-linux-gnu"
35 define void @mse(double* %A, double* %B) {
36 entry:
37   br label %entry.split
39 entry.split:                                      ; preds = %entry
40   br label %for.body
42 for.body:                                         ; preds = %entry.split, %for.end
43   %indvars.iv3 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next4, %for.end ]
44   %0 = trunc i64 %indvars.iv3 to i32
45   %conv = sitofp i32 %0 to double
46   br label %for.body5
48 for.body5:                                        ; preds = %for.body, %for.body5
49   %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body5 ]
50   %add = fadd double %conv, 3.000000e+00
51   %arrayidx = getelementptr inbounds double, double* %A, i64 %indvars.iv
52   store double %add, double* %arrayidx, align 8
53   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
54   %exitcond = icmp ne i64 %indvars.iv.next, 10000
55   br i1 %exitcond, label %for.body5, label %for.end
57 for.end:                                          ; preds = %for.body5
58   %arrayidx7 = getelementptr inbounds double, double* %B, i64 %indvars.iv3
59   store double %conv, double* %arrayidx7, align 8
60   %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
61   %exitcond5 = icmp ne i64 %indvars.iv.next4, 10000
62   br i1 %exitcond5, label %for.body, label %for.end10
64 for.end10:                                        ; preds = %for.end
65   ret void