1; RUN: opt %loadPolly -polly-delicm -analyze < %s | FileCheck %s
2;
3;    void func(double *A) {
4;      fsomeval = 21.0 + 21.0;
5;      for (int j = 0; j < 2; j += 1) { /* outer */
6;        double phi = 0.0;
7;        for (int i = 0; i < 4; i += 1) /* reduction */
8;          phi += 4.2;
9;        A[j] = fsomeval;
10;      }
11;    }
12;
13; Check that fsomeval is not mapped to A[j] because it is read-only.
14; There is no advantage in mapping values not modified within the SCoP.
15;
16define void @func(double* noalias nonnull %A) {
17entry:
18  %fsomeval = fadd double 21.0, 21.0
19  br label %outer.preheader
20
21outer.preheader:
22  br label %outer.for
23
24outer.for:
25  %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]
26  %j.cmp = icmp slt i32 %j, 2
27  br i1 %j.cmp, label %reduction.preheader, label %outer.exit
28
29
30    reduction.preheader:
31      br label %reduction.for
32
33    reduction.for:
34      %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
35      %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]
36      %i.cmp = icmp slt i32 %i, 4
37      br i1 %i.cmp, label %body, label %reduction.exit
38
39
40
41        body:
42          %add = fadd double %phi, 4.2
43          br label %reduction.inc
44
45
46
47    reduction.inc:
48      %i.inc = add nuw nsw i32 %i, 1
49      br label %reduction.for
50
51    reduction.exit:
52      %A_idx = getelementptr inbounds double, double* %A, i32 %j
53      store double %fsomeval, double* %A_idx
54      br label %outer.inc
55
56
57
58outer.inc:
59  %j.inc = add nuw nsw i32 %j, 1
60  br label %outer.for
61
62outer.exit:
63  br label %return
64
65return:
66  ret void
67}
68
69
70; CHECK: Statistics {
71; CHECK:     Compatible overwrites: 1
72; CHECK: }
73; CHECK: No modification has been made
74