Update Polly tests to handle explicitly typed gep changes in LLVM
[polly-mirror.git] / test / ScopInfo / reduction_two_identical_reads.ll
blob9e4bb284b648d84264b940d623effb1e187d2c9a
1 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops -analyze < %s | FileCheck %s
3 ; CHECK: Reduction Type: NONE
5 ; Check that we do not mark these accesses as reduction like.
6 ; We do this for the case the loads are modelt with the same LLVM-IR value and
7 ; for the case there are different LLVM-IR values.
9 ;    void f(int *A) {
10 ;      for (int i = 0; i < 1024; i++)
11 ;        A[i] = A[i] + A[i];
12 ;    }
14 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
16 define void @f_one_load_case(i32* %A) {
17 entry:
18   br label %for.cond
20 for.cond:                                         ; preds = %for.inc, %entry
21   %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
22   %exitcond = icmp ne i32 %i.0, 1024
23   br i1 %exitcond, label %for.body, label %for.end
25 for.body:                                         ; preds = %for.cond
26   %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.0
27   %tmp = load i32* %arrayidx, align 4
28   %add = add nsw i32 %tmp, %tmp
29   %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %i.0
30   store i32 %add, i32* %arrayidx2, align 4
31   br label %for.inc
33 for.inc:                                          ; preds = %for.body
34   %inc = add nsw i32 %i.0, 1
35   br label %for.cond
37 for.end:                                          ; preds = %for.cond
38   ret void
41 define void @f_two_loads_case(i32* %A) {
42 entry:
43   br label %for.cond
45 for.cond:                                         ; preds = %for.inc, %entry
46   %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
47   %exitcond = icmp ne i32 %i.0, 1024
48   br i1 %exitcond, label %for.body, label %for.end
50 for.body:                                         ; preds = %for.cond
51   %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.0
52   %tmp = load i32* %arrayidx, align 4
53   %arrayidxCopy = getelementptr inbounds i32, i32* %A, i32 %i.0
54   %tmpCopy = load i32* %arrayidxCopy, align 4
55   %add = add nsw i32 %tmp, %tmpCopy
56   %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %i.0
57   store i32 %add, i32* %arrayidx2, align 4
58   br label %for.inc
60 for.inc:                                          ; preds = %for.body
61   %inc = add nsw i32 %i.0, 1
62   br label %for.cond
64 for.end:                                          ; preds = %for.cond
65   ret void