• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
2;
3; FIXME: Change the comment once we allow different pointers
4; The statement is "almost" reduction like but should not yield any reduction dependences
5;
6; We are limited to binary reductions at the moment and this is not one.
7; There are never at least two iterations which read __and__ write to the same
8; location, thus we won't find the RAW and WAW dependences of a reduction,
9; thus we should not find Reduction dependences.
10;
11; CHECK:  Reduction dependences:
12; CHECK:    {  }
13;
14; void f(int *sum) {
15;   for (int i = 0; i < 100; i++)
16;     sum[i] = sum[99-i] + i;
17; }
18target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
19
20define void @f(i32* %sum) {
21entry:
22  br label %for.cond
23
24for.cond:                                         ; preds = %for.inc, %entry
25  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
26  %exitcond = icmp ne i32 %i.0, 100
27  br i1 %exitcond, label %for.body, label %for.end
28
29for.body:                                         ; preds = %for.cond
30  %sub = sub nsw i32 99, %i.0
31  %arrayidx = getelementptr inbounds i32, i32* %sum, i32 %sub
32  %tmp = load i32, i32* %arrayidx, align 4
33  %add = add nsw i32 %tmp, %i.0
34  %arrayidx1 = getelementptr inbounds i32, i32* %sum, i32 %i.0
35  store i32 %add, i32* %arrayidx1, align 4
36  br label %for.inc
37
38for.inc:                                          ; preds = %for.body
39  %inc = add nsw i32 %i.0, 1
40  br label %for.cond
41
42for.end:                                          ; preds = %for.cond
43  ret void
44}
45