1 ; RUN: opt %loadPolly -polly-scops -analyze \
2 ; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
4 ; CHECK: Invariant Accesses: {
5 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
6 ; CHECK-NEXT: MemRef_bounds[0]
7 ; CHECK-NEXT: Execution Context: [bounds0, bounds1] -> { : }
8 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
9 ; CHECK-NEXT: MemRef_bounds[1]
10 ; CHECK-NEXT: Execution Context: [bounds0, bounds1] -> { : }
13 ; double A[1000][1000];
18 ; for (long i = 0; i <= bounds[0]; i++)
19 ; for (long j = 0; j <= bounds[1]; j++)
23 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25 @bounds = common global [2 x i64] zeroinitializer, align 16
26 @A = common global [1000 x [1000 x double]] zeroinitializer, align 16
32 for.cond: ; preds = %for.inc.6, %entry
33 %i.0 = phi i64 [ 0, %entry ], [ %inc7, %for.inc.6 ]
34 %bounds0 = load i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @bounds, i64 0, i64 0), align 16
35 %cmp = icmp sgt i64 %i.0, %bounds0
36 br i1 %cmp, label %for.end.8, label %for.body
38 for.body: ; preds = %for.cond
41 for.cond.1: ; preds = %for.inc, %for.body
42 %j.0 = phi i64 [ 0, %for.body ], [ %inc, %for.inc ]
43 %bounds1 = load i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @bounds, i64 0, i64 1), align 8
44 %cmp2 = icmp sgt i64 %j.0, %bounds1
45 br i1 %cmp2, label %for.end, label %for.body.3
47 for.body.3: ; preds = %for.cond.1
48 %add = add nsw i64 %i.0, %j.0
49 %conv = sitofp i64 %add to double
50 %arrayidx4 = getelementptr inbounds [1000 x [1000 x double]], [1000 x [1000 x double]]* @A, i64 0, i64 %i.0, i64 %j.0
51 %tmp2 = load double, double* %arrayidx4, align 8
52 %add5 = fadd double %tmp2, %conv
53 store double %add5, double* %arrayidx4, align 8
56 for.inc: ; preds = %for.body.3
57 %inc = add nuw nsw i64 %j.0, 1
60 for.end: ; preds = %for.cond.1
63 for.inc.6: ; preds = %for.end
64 %inc7 = add nuw nsw i64 %i.0, 1
67 for.end.8: ; preds = %for.cond