blob: e1f0df17624e3fa698f652c6921bb486ea9c6018 [file] [log] [blame]
Tobias Grosserf4ee3712015-10-06 15:36:44 +00001; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
Johannes Doerferte58a0122014-06-27 20:31:28 +00002;
Johannes Doerfert32868bf2014-08-01 08:13:25 +00003; CHECK: Reduction Type: +
4; CHECK: Reduction Type: +
5; CHECK: Reduction Type: *
6; CHECK: Reduction Type: *
Johannes Doerferte58a0122014-06-27 20:31:28 +00007;
8; void f(int *sums) {
9; for (int i = 0; i < 1024; i++) {
10; for (int j = 0; j < 1024; j++) {
11; sums[i] += 5;
12; sums[i+1024] *= 5;
13; }
14; }
15; }
16target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
17
18define void @f(i32* %sums) {
19entry:
20 br label %for.cond
21
22for.cond: ; preds = %for.inc6, %entry
23 %i.0 = phi i32 [ 0, %entry ], [ %inc7, %for.inc6 ]
24 %exitcond1 = icmp ne i32 %i.0, 1024
25 br i1 %exitcond1, label %for.body, label %for.end8
26
27for.body: ; preds = %for.cond
28 br label %for.cond1
29
30for.cond1: ; preds = %for.inc, %for.body
31 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
32 %exitcond = icmp ne i32 %j.0, 1024
33 br i1 %exitcond, label %for.body3, label %for.end
34
35for.body3: ; preds = %for.cond1
David Blaikiebad3ff22015-02-27 19:20:19 +000036 %arrayidx = getelementptr inbounds i32, i32* %sums, i32 %i.0
David Blaikiec94eca02015-02-27 21:22:50 +000037 %tmp = load i32, i32* %arrayidx, align 4
Johannes Doerferte58a0122014-06-27 20:31:28 +000038 %add = add nsw i32 %tmp, 5
39 store i32 %add, i32* %arrayidx, align 4
40 %add4 = add nsw i32 %i.0, 1024
David Blaikiebad3ff22015-02-27 19:20:19 +000041 %arrayidx5 = getelementptr inbounds i32, i32* %sums, i32 %add4
David Blaikiec94eca02015-02-27 21:22:50 +000042 %tmp2 = load i32, i32* %arrayidx5, align 4
Johannes Doerferte58a0122014-06-27 20:31:28 +000043 %mul = mul nsw i32 %tmp2, 5
44 store i32 %mul, i32* %arrayidx5, align 4
45 br label %for.inc
46
47for.inc: ; preds = %for.body3
48 %inc = add nsw i32 %j.0, 1
49 br label %for.cond1
50
51for.end: ; preds = %for.cond1
52 br label %for.inc6
53
54for.inc6: ; preds = %for.end
55 %inc7 = add nsw i32 %i.0, 1
56 br label %for.cond
57
58for.end8: ; preds = %for.cond
59 ret void
60}