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 expansion of an array with load after store in a same statement is not done.
8 ; Original source code :
13 ; void mse(double A[Ni], double B[Nj], double C[Nj], double D[Nj]) {
15 ; for (i = 0; i < Ni; i++) {
16 ; for (int j = 0; j<Nj; j++) {
23 ; Check that C is expanded
25 ; CHECK: i64 MemRef_C_Stmt_for_body4_expanded[10000][10000]; // Element size 8
26 ; CHECK: new: { Stmt_for_body4[i0, i1] -> MemRef_C_Stmt_for_body4_expanded[i0, i1] };
28 ; Check that B is not expanded
30 ; CHECK-NOT: double MemRef_B_Stmt_for_body4_expanded[10000][10000]; // Element size 8
31 ; MSE: MemRef_B has read after write to the same element in same statement. The dependences found during analysis may be wrong because Polly is not able to handle such case for now.
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, ptr %C, ptr %D) {
40 entry.split: ; preds = %entry
43 for.body: ; preds = %entry.split, %for.inc9
44 %i.02 = phi i32 [ 0, %entry.split ], [ %inc10, %for.inc9 ]
47 for.body4: ; preds = %for.body, %for.body4
48 %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body4 ]
49 %0 = trunc i64 %indvars.iv to i32
50 %conv = sitofp i32 %0 to double
51 %arrayidx = getelementptr inbounds double, ptr %B, i64 %indvars.iv
52 store double %conv, ptr %arrayidx, align 8
53 %arrayidx6 = getelementptr inbounds double, ptr %B, i64 %indvars.iv
54 %1 = load i64, ptr %arrayidx6, align 8
55 %arrayidx8 = getelementptr inbounds double, ptr %C, i64 %indvars.iv
56 store i64 %1, ptr %arrayidx8, align 8
57 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
58 %exitcond = icmp ne i64 %indvars.iv.next, 10000
59 br i1 %exitcond, label %for.body4, label %for.inc9
61 for.inc9: ; preds = %for.body4
62 %inc10 = add nuw nsw i32 %i.02, 1
63 %exitcond3 = icmp ne i32 %inc10, 10000
64 br i1 %exitcond3, label %for.body, label %for.end11
66 for.end11: ; preds = %for.inc9