2015-11-22 07:05:48 +08:00
|
|
|
; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
|
2014-09-27 19:02:39 +08:00
|
|
|
;
|
|
|
|
; A valid Scop would print the list of it's statements, we check that we do not
|
|
|
|
; see that list.
|
|
|
|
;
|
|
|
|
; CHECK-NOT: Statements
|
|
|
|
;
|
|
|
|
; FIXME: Handling this is an open problem, at the moment we just bail out.
|
|
|
|
;
|
|
|
|
; void foo(float *A, float *B,
|
|
|
|
; long p1,
|
|
|
|
; long p2,
|
|
|
|
; long p3,
|
|
|
|
; long p4,
|
|
|
|
; long p5,
|
|
|
|
; long p6,
|
|
|
|
; long p7,
|
|
|
|
; long p8,
|
|
|
|
; long p9,
|
|
|
|
; long p10,
|
|
|
|
; long p11,
|
|
|
|
; long p12) {
|
|
|
|
; for (long i = 0; i < 100; i++) {
|
|
|
|
; A[i] =
|
|
|
|
; B[i + p1] +
|
|
|
|
; B[i + p2] +
|
|
|
|
; B[i + p3] +
|
|
|
|
; B[i + p4] +
|
|
|
|
; B[i + p5] +
|
|
|
|
; B[i + p6] +
|
|
|
|
; B[i + p7] +
|
|
|
|
; B[i + p8] +
|
|
|
|
; B[i + p9] +
|
|
|
|
; B[i + p10] +
|
|
|
|
; B[i + p11] +
|
|
|
|
; B[i + p12];
|
|
|
|
; }
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; Computing the minimal and maximal element accessed in B is very expensive.
|
|
|
|
; Expressing the minimal element itself yields a rather complex isl_pw_aff which
|
|
|
|
; looks as follows:
|
|
|
|
; { ...
|
|
|
|
; MemRef_B[(100 + p11)] : p2 <= -1 + p1 and p3 <= -1 + p1 and p4 <= -1 + p1
|
|
|
|
; and p5 <= -1 + p1 and p6 <= -1 + p1 and
|
|
|
|
; p7 <= -1 + p1 and p8 <= -1 + p1 and p9 <= -1 + p1
|
|
|
|
; and p10 <= -1 + p1 and p11 >= p1 and
|
|
|
|
; p12 <= -1 + p11;
|
|
|
|
; MemRef_B[(100 + p12)] : p2 <= -1 + p1 and p3 <= -1 + p1 and p4 <= -1 + p1
|
|
|
|
; and p5 <= -1 + p1 and p6 <= -1 + p1 and
|
|
|
|
; p7 <= -1 + p1 and p8 <= -1 + p1 and p9 <= -1 + p1
|
|
|
|
; and p10 <= -1 + p1 and p11 <= -1 + p1 and p12 >= p1;
|
|
|
|
;
|
|
|
|
; and this isl_pw_aff is then 1:1 translated into a isl ast expression.
|
|
|
|
;
|
|
|
|
; In the best case, we would create a run-time check such as:
|
|
|
|
;
|
|
|
|
; if (B[99 + max(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12)] < A[0]
|
|
|
|
; || A[99] B[min(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9]))
|
|
|
|
;
|
|
|
|
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
define void @foo(float* %A, float* %B, i64 %p1, i64 %p2, i64 %p3, i64 %p4, i64 %p5, i64 %p6, i64 %p7, i64 %p8, i64 %p9, i64 %p10, i64 %p11, i64 %p12) #0 {
|
|
|
|
entry:
|
|
|
|
br label %entry.split
|
|
|
|
|
|
|
|
entry.split: ; preds = %entry
|
|
|
|
br label %for.body
|
|
|
|
|
|
|
|
for.body: ; preds = %entry.split, %for.body
|
|
|
|
%i.01 = phi i64 [ 0, %entry.split ], [ %tmp25, %for.body ]
|
|
|
|
%tmp = add i64 %p1, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx = getelementptr float, float* %B, i64 %tmp
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp2 = add i64 %p2, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx2 = getelementptr float, float* %B, i64 %tmp2
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp3 = add i64 %p3, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx5 = getelementptr float, float* %B, i64 %tmp3
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp4 = add i64 %p4, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx8 = getelementptr float, float* %B, i64 %tmp4
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp5 = add i64 %p5, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx11 = getelementptr float, float* %B, i64 %tmp5
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp6 = add i64 %p6, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx14 = getelementptr float, float* %B, i64 %tmp6
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp7 = add i64 %p7, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx17 = getelementptr float, float* %B, i64 %tmp7
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp8 = add i64 %p8, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx20 = getelementptr float, float* %B, i64 %tmp8
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp9 = add i64 %p9, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx23 = getelementptr float, float* %B, i64 %tmp9
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp10 = add i64 %p10, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx26 = getelementptr float, float* %B, i64 %tmp10
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp11 = add i64 %p11, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx29 = getelementptr float, float* %B, i64 %tmp11
|
2014-09-27 19:02:39 +08:00
|
|
|
%tmp12 = add i64 %p12, %i.01
|
2015-02-28 03:20:19 +08:00
|
|
|
%arrayidx32 = getelementptr float, float* %B, i64 %tmp12
|
|
|
|
%arrayidx34 = getelementptr float, float* %A, i64 %i.01
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp13 = load float, float* %arrayidx, align 4
|
|
|
|
%tmp14 = load float, float* %arrayidx2, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add3 = fadd float %tmp13, %tmp14
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp15 = load float, float* %arrayidx5, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add6 = fadd float %add3, %tmp15
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp16 = load float, float* %arrayidx8, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add9 = fadd float %add6, %tmp16
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp17 = load float, float* %arrayidx11, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add12 = fadd float %add9, %tmp17
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp18 = load float, float* %arrayidx14, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add15 = fadd float %add12, %tmp18
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp19 = load float, float* %arrayidx17, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add18 = fadd float %add15, %tmp19
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp20 = load float, float* %arrayidx20, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add21 = fadd float %add18, %tmp20
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp21 = load float, float* %arrayidx23, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add24 = fadd float %add21, %tmp21
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp22 = load float, float* %arrayidx26, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add27 = fadd float %add24, %tmp22
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp23 = load float, float* %arrayidx29, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add30 = fadd float %add27, %tmp23
|
2015-02-28 05:22:50 +08:00
|
|
|
%tmp24 = load float, float* %arrayidx32, align 4
|
2014-09-27 19:02:39 +08:00
|
|
|
%add33 = fadd float %add30, %tmp24
|
|
|
|
store float %add33, float* %arrayidx34, align 4
|
|
|
|
%tmp25 = add nsw i64 %i.01, 1
|
|
|
|
%exitcond = icmp ne i64 %tmp25, 100
|
|
|
|
br i1 %exitcond, label %for.body, label %for.end
|
|
|
|
|
|
|
|
for.end: ; preds = %for.body
|
|
|
|
ret void
|
|
|
|
}
|