1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-print-function-scops -disable-output < %s | FileCheck %s
4 ; void foo(float A[][20][30], long n, long m, long p) {
5 ; for (long i = 0; i < n; i++)
6 ; for (long j = 0; j < m; j++)
7 ; for (long k = 0; k < p; k++)
8 ; A[i][j][k] = i + j + k;
11 ; For the above code we want to assume that all memory accesses are within the
12 ; bounds of the array A. In C (and LLVM-IR) this is not required, such that out
13 ; of bounds accesses are valid. However, as such accesses are uncommon, cause
14 ; complicated dependence pattern and as a result make dependence analysis more
15 ; costly and may prevent or hinder useful program transformations, we assume
16 ; absence of out-of-bound accesses. To do so we derive the set of parameter
17 ; values for which our assumption holds.
19 ; CHECK: Assumed Context
20 ; CHECK-NEXT: [n, m, p] -> { :
26 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
28 define void @foo(ptr %A, i64 %n, i64 %m, i64 %p) {
32 for.cond: ; preds = %for.inc13, %entry
33 %i.0 = phi i64 [ 0, %entry ], [ %inc14, %for.inc13 ]
34 %cmp = icmp slt i64 %i.0, %n
35 br i1 %cmp, label %for.body, label %for.end15
37 for.body: ; preds = %for.cond
40 for.cond1: ; preds = %for.inc10, %for.body
41 %j.0 = phi i64 [ 0, %for.body ], [ %inc11, %for.inc10 ]
42 %cmp2 = icmp slt i64 %j.0, %m
43 br i1 %cmp2, label %for.body3, label %for.end12
45 for.body3: ; preds = %for.cond1
48 for.cond4: ; preds = %for.inc, %for.body3
49 %k.0 = phi i64 [ 0, %for.body3 ], [ %inc, %for.inc ]
50 %cmp5 = icmp slt i64 %k.0, %p
51 br i1 %cmp5, label %for.body6, label %for.end
53 for.body6: ; preds = %for.cond4
54 %add = add nsw i64 %i.0, %j.0
55 %add7 = add nsw i64 %add, %k.0
56 %conv = sitofp i64 %add7 to float
57 %arrayidx9 = getelementptr inbounds [20 x [30 x float]], ptr %A, i64 %i.0, i64 %j.0, i64 %k.0
58 store float %conv, ptr %arrayidx9, align 4
61 for.inc: ; preds = %for.body6
62 %inc = add nsw i64 %k.0, 1
65 for.end: ; preds = %for.cond4
68 for.inc10: ; preds = %for.end
69 %inc11 = add nsw i64 %j.0, 1
72 for.end12: ; preds = %for.cond1
75 for.inc13: ; preds = %for.end12
76 %inc14 = add nsw i64 %i.0, 1
79 for.end15: ; preds = %for.cond