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