• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-optree -analyze < %s | FileCheck %s -match-full-lines
2;
3; Copy %val to bodyB, assuming the exit value of %i.
4;
5; for (int j = 0; j < n; j += 1) {
6;   double val;
7;   for (int i = 0; i < 128; i += 1) {
8; bodyA:
9;     val = j;
10;   }
11;
12; bodyB:
13;   A[0] = val;
14; }
15;
16define void @func(i32 %n, double* noalias nonnull %A) {
17entry:
18  br label %for
19
20for:
21  %j = phi i32 [0, %entry], [%j.inc, %inc]
22  %j.cmp = icmp slt i32 %j, %n
23  br i1 %j.cmp, label %inner.for, label %exit
24
25    inner.for:
26      %i = phi i32 [0, %for], [%i.inc, %inner.inc]
27      br label %bodyA
28
29
30        bodyA:
31          %val = sitofp i32 %i to double
32          br label %inner.inc
33
34
35    inner.inc:
36      %i.inc = add nuw nsw i32 %i, 1
37      %i.cmp = icmp slt i32 %i.inc, 128
38      br i1 %i.cmp, label %inner.for, label %inner.exit
39
40    inner.exit:
41       br label %bodyB
42
43
44    bodyB:
45      store double %val, double* %A
46      br label %inc
47
48inc:
49  %j.inc = add nuw nsw i32 %j, 1
50  br label %for
51
52exit:
53  br label %return
54
55return:
56  ret void
57}
58
59
60; CHECK: Statistics {
61; CHECK:     Instructions copied: 1
62; CHECK:     Operand trees forwarded: 1
63; CHECK:     Statements with forwarded operand trees: 1
64; CHECK: }
65
66; CHECK:      After statements {
67; CHECK-NEXT:     Stmt_bodyA
68; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]
69; CHECK-NEXT:                 [n] -> { Stmt_bodyA[i0, i1] -> MemRef_val[] };
70; CHECK-NEXT:             Instructions {
71; CHECK-NEXT:                   %val = sitofp i32 %i to double
72; CHECK-NEXT:             }
73; CHECK-NEXT:     Stmt_bodyB
74; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
75; CHECK-NEXT:                 [n] -> { Stmt_bodyB[i0] -> MemRef_A[0] };
76; CHECK-NEXT:             Instructions {
77; CHECK-NEXT:                   %val = sitofp i32 %i to double
78; CHECK-NEXT:                   store double %val, double* %A, align 8
79; CHECK-NEXT:             }
80; CHECK-NEXT: }
81