1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2;
3; CHECK: Reduction Type: NONE
4;
5;    int c, d;
6;    void f(int *sum) {
7;      for (int i = 0; i < 1024; i++)
8;        *sum = c + d;
9;    }
10;
11target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
12
13@c = common global i32 0, align 4
14@d = common global i32 0, align 4
15
16define void @loads_outside_scop(i32* %sum) {
17entry:
18  %tmp = load i32, i32* @c, align 4
19  %tmp1 = load i32, i32* @d, align 4
20  br label %for.cond
21
22for.cond:                                         ; preds = %for.inc, %entry
23  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
24  %exitcond = icmp ne i32 %i.0, 1024
25  br i1 %exitcond, label %for.body, label %for.end
26
27for.body:                                         ; preds = %for.cond
28  %add = add nsw i32 %tmp, %tmp1
29  store i32 %add, i32* %sum, align 4
30  br label %for.inc
31
32for.inc:                                          ; preds = %for.body
33  %inc = add nsw i32 %i.0, 1
34  br label %for.cond
35
36for.end:                                          ; preds = %for.cond
37  ret void
38}
39
40
41define void @binop_outside_scop(i32* %sum) {
42entry:
43  %tmp = load i32, i32* @c, align 4
44  %tmp1 = load i32, i32* @d, align 4
45  %add = add nsw i32 %tmp, %tmp1
46  br label %for.cond
47
48for.cond:                                         ; preds = %for.inc, %entry
49  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
50  %exitcond = icmp ne i32 %i.0, 1024
51  br i1 %exitcond, label %for.body, label %for.end
52
53for.body:                                         ; preds = %for.cond
54  store i32 %add, i32* %sum, align 4
55  br label %for.inc
56
57for.inc:                                          ; preds = %for.body
58  %inc = add nsw i32 %i.0, 1
59  br label %for.cond
60
61for.end:                                          ; preds = %for.cond
62  ret void
63}
64