blob: 25bf1b630eeb5ccff3a50744ca5f89eba75c27a7 [file] [log] [blame]
Johannes Doerfert09e36972015-10-07 20:17:36 +00001; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2;
3; CHECK: Invariant Accesses: {
4; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
5; CHECK-NEXT: MemRef_bounds[0]
6; CHECK-NEXT: Execution Context: [tmp, tmp1] -> { : }
7; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
8; CHECK-NEXT: MemRef_bounds[1]
9; CHECK-NEXT: Execution Context: [tmp, tmp1] -> { : tmp >= 0 }
10; CHECK: }
11
12; double A[1000][1000];
13; long bounds[2];
14;
15; void foo() {
16;
17; for (long i = 0; i <= bounds[0]; i++)
18; for (long j = 0; j <= bounds[1]; j++)
19; A[i][j] += i + j;
20; }
21;
22target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23
24@bounds = common global [2 x i64] zeroinitializer, align 16
25@A = common global [1000 x [1000 x double]] zeroinitializer, align 16
26
27define void @foo() {
28entry:
29 br label %for.cond
30
31for.cond: ; preds = %for.inc.6, %entry
32 %i.0 = phi i64 [ 0, %entry ], [ %inc7, %for.inc.6 ]
33 %tmp = load i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @bounds, i64 0, i64 0), align 16
34 %cmp = icmp sgt i64 %i.0, %tmp
35 br i1 %cmp, label %for.end.8, label %for.body
36
37for.body: ; preds = %for.cond
38 br label %for.cond.1
39
40for.cond.1: ; preds = %for.inc, %for.body
41 %j.0 = phi i64 [ 0, %for.body ], [ %inc, %for.inc ]
42 %tmp1 = load i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @bounds, i64 0, i64 1), align 8
43 %cmp2 = icmp sgt i64 %j.0, %tmp1
44 br i1 %cmp2, label %for.end, label %for.body.3
45
46for.body.3: ; preds = %for.cond.1
47 %add = add nsw i64 %i.0, %j.0
48 %conv = sitofp i64 %add to double
49 %arrayidx4 = getelementptr inbounds [1000 x [1000 x double]], [1000 x [1000 x double]]* @A, i64 0, i64 %i.0, i64 %j.0
50 %tmp2 = load double, double* %arrayidx4, align 8
51 %add5 = fadd double %tmp2, %conv
52 store double %add5, double* %arrayidx4, align 8
53 br label %for.inc
54
55for.inc: ; preds = %for.body.3
56 %inc = add nuw nsw i64 %j.0, 1
57 br label %for.cond.1
58
59for.end: ; preds = %for.cond.1
60 br label %for.inc.6
61
62for.inc.6: ; preds = %for.end
63 %inc7 = add nuw nsw i64 %i.0, 1
64 br label %for.cond
65
66for.end.8: ; preds = %for.cond
67 ret void
68}