comparison polly/test/ScopInfo/reduction_alternating_base.ll @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children c4bab56944e8
comparison
equal deleted inserted replaced
147:c2174574ed3a 150:1d019706d866
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 ;
14 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
15
16 define void @f(i32* %A) {
17 entry:
18 br label %for.cond
19
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
24
25 for.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
33 for.inc: ; preds = %for.body
34 %inc = add nsw i32 %i.0, 1
35 br label %for.cond
36
37 for.end: ; preds = %for.cond
38 ret void
39 }