1 ; RUN: opt %loadPolly -polly-mse -polly-print-scops -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadNPMPolly "-passes=scop(print<polly-mse>)" -disable-output < %s | FileCheck %s
4 ; Verify that the accesses are correctly expanded for MemoryKind::Value
6 ; Original source code :
11 ; void mse(double A[Ni], double B[Nj]) {
14 ; for (i = 0; i < Ni; i++) {
16 ; for (int j = 0; j<Nj; j++) {
23 ; Check if the expanded SAI are created
25 ; CHECK: double MemRef_conv_Stmt_for_body_expanded[10000]; // Element size 8
27 ; Check if the memory accesses are modified
29 ; CHECK: new: { Stmt_for_body[i0] -> MemRef_conv_Stmt_for_body_expanded[i0] };
30 ; CHECK: new: { Stmt_for_body5[i0, i1] -> MemRef_conv_Stmt_for_body_expanded[i0] };
31 ; CHECK: new: { Stmt_for_end[i0] -> MemRef_conv_Stmt_for_body_expanded[i0] };
33 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
34 target triple = "x86_64-unknown-linux-gnu"
36 define void @mse(ptr %A, ptr %B) {
40 entry.split: ; preds = %entry
43 for.body: ; preds = %entry.split, %for.end
44 %indvars.iv3 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next4, %for.end ]
45 %0 = trunc i64 %indvars.iv3 to i32
46 %conv = sitofp i32 %0 to double
49 for.body5: ; preds = %for.body, %for.body5
50 %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body5 ]
51 %add = fadd double %conv, 3.000000e+00
52 %arrayidx = getelementptr inbounds double, ptr %A, i64 %indvars.iv
53 store double %add, ptr %arrayidx, align 8
54 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
55 %exitcond = icmp ne i64 %indvars.iv.next, 10000
56 br i1 %exitcond, label %for.body5, label %for.end
58 for.end: ; preds = %for.body5
59 %arrayidx7 = getelementptr inbounds double, ptr %B, i64 %indvars.iv3
60 store double %conv, ptr %arrayidx7, align 8
61 %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
62 %exitcond5 = icmp ne i64 %indvars.iv.next4, 10000
63 br i1 %exitcond5, label %for.body, label %for.end10
65 for.end10: ; preds = %for.end