1; RUN: opt %loadPolly -polly-flatten-schedule -polly-delicm-overapproximate-writes=true -polly-delicm-compute-known=true -polly-delicm -analyze < %s | FileCheck %s 2; 3; Verify that delicm can cope with never taken PHI incoming edges. 4; The edge %body -> %body_phi is never taken, hence the access MemoryKind::PHI, 5; WRITE in %body for %phi is never used. 6; When mapping %phi, the write's access relation is the empty set. 7; 8; void func(double *A) { 9; for (int j = 0; j < 2; j += 1) { /* outer */ 10; for (int i = 0; i < 4; i += 1) { /* reduction */ 11; double phi = 21.0; 12; if (j < 10) // Tautology, since 0<=j<2 13; phi = 42.0; 14; } 15; A[j] = phi; 16; } 17; } 18; 19define void @func(double* noalias nonnull %A, double* noalias nonnull %dummy) { 20entry: 21 br label %outer.preheader 22 23outer.preheader: 24 br label %outer.for 25 26outer.for: 27 %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc] 28 %j.cmp = icmp slt i32 %j, 2 29 br i1 %j.cmp, label %reduction.preheader, label %outer.exit 30 31 32 reduction.preheader: 33 %A_idx = getelementptr inbounds double, double* %A, i32 %j 34 br label %reduction.for 35 36 reduction.for: 37 %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc] 38 br label %body 39 40 41 42 body: 43 %cond = icmp slt i32 %j, 10 44 br i1 %cond, label %alwaystaken, label %body_phi 45 46 alwaystaken: 47 store double 0.0, double* %dummy 48 br label %body_phi 49 50 body_phi: 51 %phi = phi double [21.0, %body], [42.0, %alwaystaken] 52 br label %reduction.inc 53 54 55 56 reduction.inc: 57 %i.inc = add nuw nsw i32 %i, 1 58 %i.cmp = icmp slt i32 %i.inc, 4 59 br i1 %i.cmp, label %reduction.for, label %reduction.exit 60 61 reduction.exit: 62 store double %phi, double* %A_idx 63 br label %outer.inc 64 65 66outer.inc: 67 %j.inc = add nuw nsw i32 %j, 1 68 br label %outer.for 69 70outer.exit: 71 br label %return 72 73return: 74 ret void 75} 76 77 78; CHECK: Statistics { 79; CHECK: PHI scalars mapped: 1 80; CHECK: } 81