1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s 2; 3; 4; void f(int *A) { 5; for (int i = 0; i < 1024; i++) 6; A[i % 2] += i; 7; } 8; 9; Verify that we detect the reduction on A 10; 11; CHECK: ReadAccess := [Reduction Type: +] [Scalar: 0] 12; CHECK: MustWriteAccess := [Reduction Type: +] [Scalar: 0] 13; 14target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64" 15 16define void @f(i32* %A) { 17entry: 18 br label %for.cond 19 20for.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 24 25for.body: ; preds = %for.cond 26 %rem = srem i32 %i.0, 2 27 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %rem 28 %tmp = load i32, i32* %arrayidx, align 4 29 %add = add nsw i32 %tmp, %i.0 30 store i32 %add, i32* %arrayidx, align 4 31 br label %for.inc 32 33for.inc: ; preds = %for.body 34 %inc = add nsw i32 %i.0, 1 35 br label %for.cond 36 37for.end: ; preds = %for.cond 38 ret void 39} 40