~pali/llvm/polly-3.5

« back to all changes in this revision

Viewing changes to test/Isl/Ast/reduction_dependences_equal_non_reduction_dependences.ll

  • Committer: jdoerfert
  • Date: 2014-07-15 00:00:35 UTC
  • Revision ID: svn-v4:91177308-0d34-0410-b5e6-96231b3b80d8:polly/trunk:213019
Annotate reduction parallel loops in the IslAst textual output

  + Introduced dependency type TYPE_TC_RED to represent the transitive closure
    (& the reverse) of reduction dependences. These are used when we check for
    reduction parallel loops.
  + Test cases including loop reversals and modulo schedules which compute
    reductions in a alternated order.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: opt %loadPolly -basicaa -polly-ast -polly-ast-detect-parallel -analyze < %s | FileCheck %s
 
2
;
 
3
; This loopnest contains a reduction which imposes the same dependences as the
 
4
; accesses to the array A. We need to ensure we do __not__ parallelize anything
 
5
; here.
 
6
;
 
7
; CHECK-NOT: pragma
 
8
; CHECK-NOT: reduction
 
9
;
 
10
;    void AandSum(int *restrict sum, int *restrict A) {
 
11
;      for (int i = 0; i < 1024; i++) {
 
12
;        A[i] = A[i] + A[i - 1];
 
13
;        A[i - 1] = A[i] + A[i - 2];
 
14
;        *sum += i;
 
15
;      }
 
16
;    }
 
17
;
 
18
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
 
19
 
 
20
define void @AandSum(i32* noalias %sum, i32* noalias %A) {
 
21
entry:
 
22
  br label %for.cond
 
23
 
 
24
for.cond:                                         ; preds = %for.inc, %entry
 
25
  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
 
26
  %exitcond = icmp ne i32 %i.0, 1024
 
27
  br i1 %exitcond, label %for.body, label %for.end
 
28
 
 
29
for.body:                                         ; preds = %for.cond
 
30
  %arrayidx = getelementptr inbounds i32* %A, i32 %i.0
 
31
  %tmp = load i32* %arrayidx, align 4
 
32
  %sub = add nsw i32 %i.0, -1
 
33
  %arrayidx1 = getelementptr inbounds i32* %A, i32 %sub
 
34
  %tmp1 = load i32* %arrayidx1, align 4
 
35
  %add = add nsw i32 %tmp, %tmp1
 
36
  %arrayidx2 = getelementptr inbounds i32* %A, i32 %i.0
 
37
  store i32 %add, i32* %arrayidx2, align 4
 
38
  %sub4 = add nsw i32 %i.0, -2
 
39
  %arrayidx5 = getelementptr inbounds i32* %A, i32 %sub4
 
40
  %tmp2 = load i32* %arrayidx5, align 4
 
41
  %add6 = add nsw i32 %add, %tmp2
 
42
  %sub7 = add nsw i32 %i.0, -1
 
43
  %arrayidx8 = getelementptr inbounds i32* %A, i32 %sub7
 
44
  store i32 %add6, i32* %arrayidx8, align 4
 
45
  %tmp3 = load i32* %sum, align 4
 
46
  %add9 = add nsw i32 %tmp3, %i.0
 
47
  store i32 %add9, i32* %sum, align 4
 
48
  br label %for.inc
 
49
 
 
50
for.inc:                                          ; preds = %for.body
 
51
  %inc = add nsw i32 %i.0, 1
 
52
  br label %for.cond
 
53
 
 
54
for.end:                                          ; preds = %for.cond
 
55
  ret void
 
56
}