1 ; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb "-passes=scop(print<polly-mse>)" -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb "-passes=scop(print<polly-mse>)" -pass-remarks-analysis="polly-mse" -disable-output < %s 2>&1 | FileCheck %s --check-prefix=MSE
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.
7 ; Original source code :
12 ; void mse(double A[Ni], double B[Nj]) {
16 ; for (i = 0; i < Ni; i++) {
17 ; for(j = 0; j < Nj; j++) {
24 ; Check that the pass detects that tmp_05 and tmp2_06 read from their original values.
26 ; MSE-DAG: MemRef_tmp_05__phi read from its original value.
27 ; MSE-DAG: MemRef_tmp2_06__phi read from its original value.
29 ; Check that the SAI are created except the expanded SAI of tmp_05 and tmp2_06.
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
38 ; Check that the memory accesses are modified except those related to tmp_05 and tmp_06.
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] };
55 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
56 target triple = "x86_64-unknown-linux-gnu"
58 define void @tmp(ptr %A, ptr %B) {
62 entry.split: ; preds = %entry
65 for.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 ]
71 for.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
82 for.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
89 for.end6: ; preds = %for.inc4