1 ; RUN: opt %loadPolly -polly-flatten-schedule -polly-delicm-overapproximate-writes=true -polly-delicm-compute-known=true -polly-print-delicm -disable-output < %s | FileCheck %s
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.
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 */
12 ; if (j < 10) // Tautology, since 0<=j<2
19 define void @func(ptr noalias nonnull %A, ptr noalias nonnull %dummy) {
21 br label %outer.preheader
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
33 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
34 br label %reduction.for
37 %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
43 %cond = icmp slt i32 %j, 10
44 br i1 %cond, label %alwaystaken, label %body_phi
47 store double 0.0, ptr %dummy
51 %phi = phi double [21.0, %body], [42.0, %alwaystaken]
52 br label %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
62 store double %phi, ptr %A_idx
67 %j.inc = add nuw nsw i32 %j, 1
79 ; CHECK: PHI scalars mapped: 1