1; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-delicm-partial-writes=true -polly-delicm -analyze < %s | FileCheck -match-full-lines %s 2; 3; void func(double *A) { 4; for (int j = 0; j < 2; j += 1) { /* outer */ 5; double phi = 0.0; 6; for (int i = 0; i < 4; i += 1) /* reduction */ 7; phi += 4.2; 8; A[j] = phi; 9; } 10; } 11; 12define void @func(double* noalias nonnull %A) { 13entry: 14 br label %outer.for 15 16outer.for: 17 %j = phi i32 [0, %entry], [%j.inc, %outer.inc] 18 %j.cmp = icmp slt i32 %j, 2 19 br i1 %j.cmp, label %reduction.for, label %outer.exit 20 21 22 reduction.for: 23 %i = phi i32 [0, %outer.for], [%i.inc, %reduction.inc] 24 %phi = phi double [0.0, %outer.for], [%add, %reduction.inc] 25 %i.cmp = icmp slt i32 %i, 4 26 br i1 %i.cmp, label %body, label %reduction.exit 27 28 29 30 body: 31 %add = fadd double %phi, 4.2 32 br label %reduction.inc 33 34 35 36 reduction.inc: 37 %i.inc = add nuw nsw i32 %i, 1 38 br label %reduction.for 39 40 reduction.exit: 41 %A_idx = getelementptr inbounds double, double* %A, i32 %j 42 store double %phi, double* %A_idx 43 br label %outer.inc 44 45 46 47outer.inc: 48 %j.inc = add nuw nsw i32 %j, 1 49 br label %outer.for 50 51outer.exit: 52 br label %return 53 54return: 55 ret void 56} 57 58 59; CHECK: After accesses { 60; CHECK-NEXT: Stmt_outer_for 61; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 62; CHECK-NEXT: { Stmt_outer_for[i0] -> MemRef_phi__phi[] }; 63; CHECK-NEXT: new: { Stmt_outer_for[i0] -> MemRef_A[i0] : i0 <= 1 }; 64; CHECK-NEXT: Stmt_reduction_for 65; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 66; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] }; 67; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] }; 68; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 69; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi[] }; 70; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] }; 71; CHECK-NEXT: Stmt_body 72; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 73; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_add[] }; 74; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] }; 75; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 76; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_phi[] }; 77; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] }; 78; CHECK-NEXT: Stmt_reduction_inc 79; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 80; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_add[] }; 81; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] }; 82; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 83; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] }; 84; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] }; 85; CHECK-NEXT: Stmt_reduction_exit 86; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] 87; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_A[i0] }; 88; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 89; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_phi[] }; 90; CHECK-NEXT: new: { Stmt_reduction_exit[i0] -> MemRef_A[i0] }; 91; CHECK-NEXT: } 92