1; RUN: opt -basic-aa %loadPolly -polly-stmt-granularity=bb -polly-scops -analyze -polly-disable-multiplicative-reductions < %s | FileCheck %s
2;
3; CHECK: ReadAccess :=       [Reduction Type: +
4; CHECK:     { Stmt_for_body[i0] -> MemRef_sum[0] };
5; CHECK: MustWriteAccess :=  [Reduction Type: +
6; CHECK:     { Stmt_for_body[i0] -> MemRef_sum[0] };
7; CHECK: ReadAccess :=       [Reduction Type: NONE
8; CHECK:     { Stmt_for_body[i0] -> MemRef_prod[0] };
9; CHECK: MustWriteAccess :=  [Reduction Type: NONE
10; CHECK:     { Stmt_for_body[i0] -> MemRef_prod[0] };
11;
12; int sum, prod;
13;
14; void f() {
15;   int i;
16;   for (int i = 0; i < 100; i++) {
17;     sum += i * 3;
18;     prod *= (i + 3);
19;   }
20; }
21target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
22
23@sum = common global i32 0, align 4
24@prod = common global i32 0, align 4
25
26define void @f() #0 {
27entry:
28  br label %for.cond
29
30for.cond:                                         ; preds = %for.inc, %entry
31  %i1.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
32  %exitcond = icmp ne i32 %i1.0, 100
33  br i1 %exitcond, label %for.body, label %for.end
34
35for.body:                                         ; preds = %for.cond
36  %mul = mul nsw i32 %i1.0, 3
37  %tmp = load i32, i32* @sum, align 4
38  %add = add nsw i32 %tmp, %mul
39  store i32 %add, i32* @sum, align 4
40  %add2 = add nsw i32 %i1.0, 3
41  %tmp1 = load i32, i32* @prod, align 4
42  %mul3 = mul nsw i32 %tmp1, %add2
43  store i32 %mul3, i32* @prod, align 4
44  br label %for.inc
45
46for.inc:                                          ; preds = %for.body
47  %inc = add nsw i32 %i1.0, 1
48  br label %for.cond
49
50for.end:                                          ; preds = %for.cond
51  ret void
52}
53