• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-flatten-schedule -polly-delicm -analyze < %s | FileCheck %s
2;
3;    void func(double *A) {
4;      for (int j = 0; j < 2; j += 1) { /* outer */
5;        for (int i = 0; i < 4; i += 1) { /* reduction */
6;          double phi = A[j];
7;          phi += 4.2;
8;          A[j] = phi;
9;        }
10;      }
11;    }
12;
13; There is nothing to do in this case. All accesses are in %body.
14;
15define void @func(double* noalias nonnull %A) {
16entry:
17  br label %outer.preheader
18
19outer.preheader:
20  br label %outer.for
21
22outer.for:
23  %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]
24  %j.cmp = icmp slt i32 %j, 2
25  br i1 %j.cmp, label %reduction.preheader, label %outer.exit
26
27
28    reduction.preheader:
29      br label %reduction.for
30
31    reduction.for:
32      %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
33      br label %body
34
35
36
37        body:
38          %A_idx = getelementptr inbounds double, double* %A, i32 %j
39          %val = load double, double* %A_idx
40          %add = fadd double %val, 4.2
41          store double %add, double* %A_idx
42          br label %reduction.inc
43
44
45
46    reduction.inc:
47      %i.inc = add nuw nsw i32 %i, 1
48      %i.cmp = icmp slt i32 %i.inc, 4
49      br i1 %i.cmp, label %reduction.for, label %reduction.exit
50
51    reduction.exit:
52      br label %outer.inc
53
54
55
56outer.inc:
57  %j.inc = add nuw nsw i32 %j, 1
58  br label %outer.for
59
60outer.exit:
61  br label %return
62
63return:
64  ret void
65}
66
67
68; CHECK: No modification has been made
69