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
3 ; RUN: opt %loadPolly -polly-mse -polly-print-scops -pass-remarks-analysis="polly-mse" -disable-output < %s 2>&1 | FileCheck %s --check-prefix=MSE
4 ; RUN: opt %loadNPMPolly "-passes=scop(print<polly-mse>)" -pass-remarks-analysis="polly-mse" -disable-output < %s 2>&1 | FileCheck %s --check-prefix=MSE
6 ; Verify that the accesses are correctly expanded for MemoryKind::PHI
7 ; tmp_04 is not expanded because it need copy-in.
9 ; Original source code :
14 ; void mse(double A[Ni], double B[Nj]) {
17 ; for (i = 0; i < Ni; i++) {
18 ; for (int j = 0; j<Nj; j++) {
24 ; Check that the pass detects that tmp_04 reads from original value.
26 ; MSE: MemRef_tmp_04__phi read from its original value.
28 ; Check that the SAI are created except the expanded SAI of tmp_04.
30 ; CHECK-NOT: double MemRef_tmp_04__phi_Stmt_for_body_expanded[10000]; // Element size 8
31 ; CHECK: double MemRef_tmp_11__phi_Stmt_for_inc_expanded[10000][10000]; // Element size
32 ; CHECK: double MemRef_add_lcssa__phi_Stmt_for_end_expanded[10000]; // Element size 8
33 ; CHECK: double MemRef_B_Stmt_for_end_expanded[10000]; // Element size 8
35 ; Check that the memory accesses are modified except those related to tmp_04.
37 ; CHECK-NOT: new: { Stmt_for_body[i0] -> MemRef_tmp_04__phi_Stmt_for_body_expanded[i0] };
38 ; CHECK: new: { Stmt_for_body[i0] -> MemRef_tmp_11__phi_Stmt_for_inc_expanded[i0, 0] };
39 ; CHECK: new: { Stmt_for_inc[i0, i1] -> MemRef_tmp_11__phi_Stmt_for_inc_expanded[i0, 1 + i1] : i1 <= 9998 };
40 ; CHECK: new: { Stmt_for_inc[i0, i1] -> MemRef_tmp_11__phi_Stmt_for_inc_expanded[i0, i1] };
41 ; CHECK: new: { Stmt_for_inc[i0, 9999] -> MemRef_add_lcssa__phi_Stmt_for_end_expanded[i0] };
42 ; CHECK-NOT: new: { Stmt_for_end[i0] -> MemRef_tmp_04__phi_Stmt_for_body_expanded[1 + i0] : i0 <= 9998 };
43 ; CHECK: new: { Stmt_for_end[i0] -> MemRef_add_lcssa__phi_Stmt_for_end_expanded[i0] };
44 ; CHECK: new: { Stmt_for_end[i0] -> MemRef_B_Stmt_for_end_expanded[i0] };
46 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
47 target triple = "x86_64-unknown-linux-gnu"
49 define void @tmp(ptr %A, ptr %B) {
53 entry.split: ; preds = %entry
56 for.body: ; preds = %entry.split, %for.end
57 %indvars.iv = phi i64 [ 0, %entry.split ], [ %indvars.iv.next, %for.end ]
58 %tmp.04 = phi double [ 6.000000e+00, %entry.split ], [ %add.lcssa, %for.end ]
61 for.inc: ; preds = %for.body, %for.inc
62 %j1.02 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
63 %tmp.11 = phi double [ %tmp.04, %for.body ], [ %add, %for.inc ]
64 %add = fadd double %tmp.11, 2.000000e+00
65 %inc = add nuw nsw i32 %j1.02, 1
66 %exitcond = icmp ne i32 %inc, 10000
67 br i1 %exitcond, label %for.inc, label %for.end
69 for.end: ; preds = %for.inc
70 %add.lcssa = phi double [ %add, %for.inc ]
71 %arrayidx = getelementptr inbounds double, ptr %B, i64 %indvars.iv
72 store double %add.lcssa, ptr %arrayidx, align 8
73 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
74 %exitcond5 = icmp ne i64 %indvars.iv.next, 10000
75 br i1 %exitcond5, label %for.body, label %for.end7
77 for.end7: ; preds = %for.end