1; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-mse -analyze < %s | FileCheck %s 2; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-mse -pass-remarks-analysis="polly-mse" -analyze < %s 2>&1 | FileCheck %s --check-prefix=MSE 3; 4; Verify that the accesses are correctly expanded for MemoryKind::PHI 5; tmp_05 and tmp2_06 are not expanded because they need copy-in. 6; 7; Original source code : 8; 9; #define Ni 10000 10; #define Nj 10000 11; 12; void mse(double A[Ni], double B[Nj]) { 13; int i,j; 14; double tmp = 6; 15; double tmp2 = 9; 16; for (i = 0; i < Ni; i++) { 17; for(j = 0; j < Nj; j++) { 18; tmp = tmp + tmp2; 19; tmp2 = i*j; 20; } 21; } 22; } 23; 24; Check that the pass detects that tmp_05 and tmp2_06 read from their original values. 25; 26; MSE-DAG: MemRef_tmp_05__phi read from its original value. 27; MSE-DAG: MemRef_tmp2_06__phi read from its original value. 28; 29; Check that the SAI are created except the expanded SAI of tmp_05 and tmp2_06. 30; 31; CHECK-DAG: double MemRef_add_lcssa__phi_Stmt_for_inc4_expanded[10000]; // Element size 8 32; CHECK-DAG: double MemRef_tmp2_13__phi_Stmt_for_inc_expanded[10000][10000]; // Element size 33; CHECK-DAG: double MemRef_conv_lcssa__phi_Stmt_for_inc4_expanded[10000]; // Element size 8 34; CHECK-DAG: double MemRef_tmp_12__phi_Stmt_for_inc_expanded[10000][10000]; // Element size 8 35; CHECK-NOT: double MemRef_tmp_05__phi_Stmt_for_body_expanded[10000]; // Element size 8 36; CHECK-NOT: double MemRef_tmp2_06__phi_Stmt_for_body_expanded[10000]; // Element size 8 37; 38; Check that the memory accesses are modified except those related to tmp_05 and tmp_06. 39; 40; CHECK-NOT: new: { Stmt_for_body[i0] -> MemRef_tmp2_06__phi_Stmt_for_body_expanded[i0] }; 41; CHECK-NOT: new: { Stmt_for_body[i0] -> MemRef_tmp_05__phi_Stmt_for_body_expanded[i0] }; 42; CHECK: new: { Stmt_for_body[i0] -> MemRef_tmp2_13__phi_Stmt_for_inc_expanded[i0, 0] }; 43; CHECK: new: { Stmt_for_body[i0] -> MemRef_tmp_12__phi_Stmt_for_inc_expanded[i0, 0] }; 44; CHECK: new: { Stmt_for_inc[i0, i1] -> MemRef_tmp2_13__phi_Stmt_for_inc_expanded[i0, 1 + i1] : i1 <= 9998 }; 45; CHECK: new: { Stmt_for_inc[i0, i1] -> MemRef_tmp2_13__phi_Stmt_for_inc_expanded[i0, i1] }; 46; CHECK: new: { Stmt_for_inc[i0, i1] -> MemRef_tmp_12__phi_Stmt_for_inc_expanded[i0, 1 + i1] : i1 <= 9998 }; 47; CHECK: new: { Stmt_for_inc[i0, i1] -> MemRef_tmp_12__phi_Stmt_for_inc_expanded[i0, i1] }; 48; CHECK: new: { Stmt_for_inc[i0, 9999] -> MemRef_conv_lcssa__phi_Stmt_for_inc4_expanded[i0] }; 49; CHECK: new: { Stmt_for_inc[i0, 9999] -> MemRef_add_lcssa__phi_Stmt_for_inc4_expanded[i0] }; 50; CHECK-NOT: new: { Stmt_for_inc4[i0] -> MemRef_tmp2_06__phi_Stmt_for_body_expanded[1 + i0] : i0 <= 9998 }; 51; CHECK-NOT: new: { Stmt_for_inc4[i0] -> MemRef_tmp_05__phi_Stmt_for_body_expanded[1 + i0] : i0 <= 9998 }; 52; CHECK: new: { Stmt_for_inc4[i0] -> MemRef_conv_lcssa__phi_Stmt_for_inc4_expanded[i0] }; 53; CHECK: new: { Stmt_for_inc4[i0] -> MemRef_add_lcssa__phi_Stmt_for_inc4_expanded[i0] }; 54; 55target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 56target triple = "x86_64-unknown-linux-gnu" 57 58define void @tmp(double* %A, double* %B) { 59entry: 60 br label %entry.split 61 62entry.split: ; preds = %entry 63 br label %for.body 64 65for.body: ; preds = %entry.split, %for.inc4 66 %tmp2.06 = phi double [ 9.000000e+00, %entry.split ], [ %conv.lcssa, %for.inc4 ] 67 %tmp.05 = phi double [ 6.000000e+00, %entry.split ], [ %add.lcssa, %for.inc4 ] 68 %i.04 = phi i32 [ 0, %entry.split ], [ %inc5, %for.inc4 ] 69 br label %for.inc 70 71for.inc: ; preds = %for.body, %for.inc 72 %tmp2.13 = phi double [ %tmp2.06, %for.body ], [ %conv, %for.inc ] 73 %tmp.12 = phi double [ %tmp.05, %for.body ], [ %add, %for.inc ] 74 %j.01 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ] 75 %mul = mul nuw nsw i32 %j.01, %i.04 76 %conv = sitofp i32 %mul to double 77 %add = fadd double %tmp.12, %tmp2.13 78 %inc = add nuw nsw i32 %j.01, 1 79 %exitcond = icmp ne i32 %inc, 10000 80 br i1 %exitcond, label %for.inc, label %for.inc4 81 82for.inc4: ; preds = %for.inc 83 %conv.lcssa = phi double [ %conv, %for.inc ] 84 %add.lcssa = phi double [ %add, %for.inc ] 85 %inc5 = add nuw nsw i32 %i.04, 1 86 %exitcond7 = icmp ne i32 %inc5, 10000 87 br i1 %exitcond7, label %for.body, label %for.end6 88 89for.end6: ; preds = %for.inc4 90 ret void 91} 92