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.
10 ; for (int i = 0; i < 1024; i++)
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) {
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
33 for.inc: ; preds = %for.body
34 %inc = add nsw i32 %i.0, 1
37 for.end: ; preds = %for.cond
41 define void @f_two_loads_case(i32* %A) {
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
60 for.inc: ; preds = %for.body
61 %inc = add nsw i32 %i.0, 1
64 for.end: ; preds = %for.cond