Fix Polly
[polly-mirror.git] / test / ScopInfo / reduction_two_identical_reads.ll
blob1937e731c9a3474e73b2c0d939f0f76e61e2174e
1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-function-scops -analyze < %s | FileCheck %s
4 ; CHECK: Reduction Type: NONE
6 ; Check that we do not mark these accesses as reduction like.
7 ; We do this for the case the loads are modelt with the same LLVM-IR value and
8 ; for the case there are different LLVM-IR values.
10 ;    void f(int *A) {
11 ;      for (int i = 0; i < 1024; i++)
12 ;        A[i] = A[i] + A[i];
13 ;    }
15 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
17 define void @f_one_load_case(i32* %A) {
18 entry:
19   br label %for.cond
21 for.cond:                                         ; preds = %for.inc, %entry
22   %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
23   %exitcond = icmp ne i32 %i.0, 1024
24   br i1 %exitcond, label %for.body, label %for.end
26 for.body:                                         ; preds = %for.cond
27   %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.0
28   %tmp = load i32, i32* %arrayidx, align 4
29   %add = add nsw i32 %tmp, %tmp
30   %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %i.0
31   store i32 %add, i32* %arrayidx2, align 4
32   br label %for.inc
34 for.inc:                                          ; preds = %for.body
35   %inc = add nsw i32 %i.0, 1
36   br label %for.cond
38 for.end:                                          ; preds = %for.cond
39   ret void
42 define void @f_two_loads_case(i32* %A) {
43 entry:
44   br label %for.cond
46 for.cond:                                         ; preds = %for.inc, %entry
47   %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
48   %exitcond = icmp ne i32 %i.0, 1024
49   br i1 %exitcond, label %for.body, label %for.end
51 for.body:                                         ; preds = %for.cond
52   %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.0
53   %tmp = load i32, i32* %arrayidx, align 4
54   %arrayidxCopy = getelementptr inbounds i32, i32* %A, i32 %i.0
55   %tmpCopy = load i32, i32* %arrayidxCopy, align 4
56   %add = add nsw i32 %tmp, %tmpCopy
57   %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %i.0
58   store i32 %add, i32* %arrayidx2, align 4
59   br label %for.inc
61 for.inc:                                          ; preds = %for.body
62   %inc = add nsw i32 %i.0, 1
63   br label %for.cond
65 for.end:                                          ; preds = %for.cond
66   ret void