1; RUN: opt %loadPolly -polly-delicm -analyze < %s | FileCheck %s
2;
3;    void func(double *A) {
4;      for (int j = 0; j < 2; j += 1) { /* outer */
5;        fsomeval = 21.0 + 21.0;
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;      g(fsomeval);
12;    }
13;
14; Check that fsomeval is not mapped to A[j] because it is escaping the SCoP.
15; Supporting this would require reloading the scalar from A[j], and/or
16; identifying the last instance of fsomeval that escapes.
17;
18define void @func(double* noalias nonnull %A) {
19entry:
20  br label %outer.preheader
21
22outer.preheader:
23  br label %outer.for
24
25outer.for:
26  %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]
27  %j.cmp = icmp slt i32 %j, 2
28  %fsomeval = fadd double 21.0, 21.0
29  br i1 %j.cmp, label %reduction.preheader, label %outer.exit
30
31
32    reduction.preheader:
33      br label %reduction.for
34
35    reduction.for:
36      %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
37      %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]
38      %i.cmp = icmp slt i32 %i, 4
39      br i1 %i.cmp, label %body, label %reduction.exit
40
41
42
43        body:
44          %add = fadd double %phi, 4.2
45          br label %reduction.inc
46
47
48
49    reduction.inc:
50      %i.inc = add nuw nsw i32 %i, 1
51      br label %reduction.for
52
53    reduction.exit:
54      %A_idx = getelementptr inbounds double, double* %A, i32 %j
55      store double %fsomeval, double* %A_idx
56      br label %outer.inc
57
58
59
60outer.inc:
61  %j.inc = add nuw nsw i32 %j, 1
62  br label %outer.for
63
64outer.exit:
65  br label %return
66
67return:
68  call void @g(double %fsomeval)
69  ret void
70}
71
72declare void @g(double)
73
74
75; CHECK: Statistics {
76; CHECK:     Compatible overwrites: 1
77; CHECK: }
78; CHECK: No modification has been made
79