Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,74 @@
; RUN: opt -S %loadPolly -polly-dependences -analyze < %s | FileCheck %s -check-prefix=VALUE
; RUN: opt -S %loadPolly -polly-function-dependences -analyze < %s | FileCheck %s -check-prefix=FUNC-VALUE
; RUN: opt -S %loadPolly -polly-dependences -analyze -polly-dependences-computeout=1 < %s | FileCheck %s -check-prefix=TIMEOUT
; RUN: opt -S %loadPolly -polly-function-dependences -analyze -polly-dependences-computeout=1 < %s | FileCheck %s -check-prefix=TIMEOUT
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
; for(i = 0; i < 100; i++ )
; S1: A[i] = 2;
;
; for (i = 0; i < 10; i++ )
; S2: A[i] = 5;
;
; for (i = 0; i < 200; i++ )
; S3: A[i] = 5;
define void @sequential_writes() {
entry:
%A = alloca [200 x i32]
br label %S1
S1:
%indvar.1 = phi i64 [ 0, %entry ], [ %indvar.next.1, %S1 ]
%arrayidx.1 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.1
store i32 2, i32* %arrayidx.1
%indvar.next.1 = add i64 %indvar.1, 1
%exitcond.1 = icmp ne i64 %indvar.next.1, 100
br i1 %exitcond.1, label %S1, label %exit.1
exit.1:
br label %S2
S2:
%indvar.2 = phi i64 [ 0, %exit.1 ], [ %indvar.next.2, %S2 ]
%arrayidx.2 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.2
store i32 5, i32* %arrayidx.2
%indvar.next.2 = add i64 %indvar.2, 1
%exitcond.2 = icmp ne i64 %indvar.next.2, 10
br i1 %exitcond.2, label %S2, label %exit.2
exit.2:
br label %S3
S3:
%indvar.3 = phi i64 [ 0, %exit.2 ], [ %indvar.next.3, %S3 ]
%arrayidx.3 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.3
store i32 7, i32* %arrayidx.3
%indvar.next.3 = add i64 %indvar.3, 1
%exitcond.3 = icmp ne i64 %indvar.next.3, 200
br i1 %exitcond.3, label %S3 , label %exit.3
exit.3:
ret void
}
; VALUE: RAW dependences:
; VALUE-NEXT: { }
; VALUE-NEXT: WAR dependences:
; VALUE-NEXT: { }
; VALUE-NEXT: WAW dependences:
; VALUE-NEXT: { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9; Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9; Stmt_S1[i0] -> Stmt_S3[i0] : 10 <= i0 <= 99 }
; FUNC-VALUE: RAW dependences:
; FUNC-VALUE-NEXT: { }
; FUNC-VALUE-NEXT: WAR dependences:
; FUNC-VALUE-NEXT: { }
; FUNC-VALUE-NEXT: WAW dependences:
; FUNC-VALUE-NEXT: { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9; [Stmt_S1[i0] -> Stmt_S1_Write0[]] -> [Stmt_S2[i0] -> Stmt_S2_Write0[]] : 0 <= i0 <= 9; Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9; [Stmt_S2[i0] -> Stmt_S2_Write0[]] -> [Stmt_S3[i0] -> Stmt_S3_Write0[]] : 0 <= i0 <= 9; [Stmt_S1[i0] -> Stmt_S1_Write0[]] -> [Stmt_S3[i0] -> Stmt_S3_Write0[]] : 10 <= i0 <= 99; Stmt_S1[i0] -> Stmt_S3[i0] : 10 <= i0 <= 99 }
; TIMEOUT: RAW dependences:
; TIMEOUT-NEXT: n/a
; TIMEOUT-NEXT: WAR dependences:
; TIMEOUT-NEXT: n/a
; TIMEOUT-NEXT: WAW dependences:
; TIMEOUT-NEXT: n/a

View File

@@ -0,0 +1,61 @@
; RUN: opt -S %loadPolly -polly-dependences \
; RUN: -analyze < %s | FileCheck %s
; RUN: opt -S %loadPolly -polly-function-dependences \
; RUN: -analyze < %s | FileCheck %s -check-prefix=FUNC
; CHECK: RAW dependences:
; CHECK: { Stmt_bb9[0] -> Stmt_bb10[0] }
; CHECK: WAR dependences:
; CHECK: { Stmt_bb3[0] -> Stmt_bb10[0] }
; CHECK: WAW dependences:
; CHECK: { Stmt_bb3[0] -> Stmt_bb10[0] }
; CHECK: Reduction dependences:
; CHECK: { }
; FUNC: RAW dependences:
; FUNC-NEXT: { Stmt_bb9[0] -> Stmt_bb10[0]; [Stmt_bb9[0] -> Stmt_bb9_Write0[]] -> [Stmt_bb10[0] -> Stmt_bb10_Read0[]] }
; FUNC-NEXT: WAR dependences:
; FUNC-NEXT: { [Stmt_bb3[0] -> Stmt_bb3_Read0[]] -> [Stmt_bb10[0] -> Stmt_bb10_Write1[]]; Stmt_bb3[0] -> Stmt_bb10[0] }
; FUNC-NEXT: WAW dependences:
; FUNC-NEXT: { Stmt_bb3[0] -> Stmt_bb10[0]; [Stmt_bb3[0] -> Stmt_bb3_Write1[]] -> [Stmt_bb10[0] -> Stmt_bb10_Write1[]] }
; FUNC-NEXT: Reduction dependences:
; FUNC-NEXT: { }
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @hoge(i32 %arg, [1024 x double]* %arg1) {
bb:
br label %bb2
bb2: ; preds = %bb
br label %bb3
bb3: ; preds = %bb10, %bb2
%tmp = phi i64 [ 0, %bb10 ], [ 0, %bb2 ]
%tmp4 = icmp sgt i32 %arg, 0
%tmp5 = getelementptr inbounds [1024 x double], [1024 x double]* %arg1, i64 0, i64 0
%tmp6 = load double, double* %tmp5, align 8
%tmp7 = fadd double undef, %tmp6
store double %tmp7, double* %tmp5, align 8
br i1 false, label %bb8, label %bb9
bb8: ; preds = %bb3
br label %bb10
bb9: ; preds = %bb3
br label %bb10
bb10: ; preds = %bb9, %bb8
%tmp11 = phi double [ undef, %bb8 ], [ undef, %bb9 ]
%tmp12 = getelementptr inbounds [1024 x double], [1024 x double]* %arg1, i64 %tmp, i64 0
store double %tmp11, double* %tmp12, align 8
%tmp13 = add nuw nsw i64 0, 1
%tmp14 = trunc i64 %tmp13 to i32
br i1 false, label %bb3, label %bb15
bb15: ; preds = %bb10
br label %bb16
bb16: ; preds = %bb15
ret void
}

View File

@@ -0,0 +1,95 @@
; RUN: opt %loadPolly -basicaa -polly-dependences -analyze -polly-dependences-analysis-type=value-based < %s | FileCheck %s -check-prefix=VALUE
; RUN: opt %loadPolly -basicaa -polly-dependences -analyze -polly-dependences-analysis-type=memory-based < %s | FileCheck %s -check-prefix=MEMORY
; RUN: opt %loadPolly -basicaa -polly-function-dependences -analyze -polly-dependences-analysis-type=value-based < %s | FileCheck %s -check-prefix=FUNC-VALUE
; RUN: opt %loadPolly -basicaa -polly-function-dependences -analyze -polly-dependences-analysis-type=memory-based < %s | FileCheck %s -check-prefix=FUNC-MEMORY
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }
%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
@A = common global [36 x [49 x double]] zeroinitializer, align 8 ; <[36 x [49 x double]]*> [#uses=3]
@B = common global [36 x [49 x double]] zeroinitializer, align 8 ; <[36 x [49 x double]]*> [#uses=3]
@C = common global [36 x [49 x double]] zeroinitializer, align 8 ; <[36 x [49 x double]]*> [#uses=4]
define void @do_pluto_matmult() nounwind {
entry:
fence seq_cst
br label %do.body
do.body: ; preds = %do.cond42, %entry
%indvar3 = phi i64 [ %indvar.next4, %do.cond42 ], [ 0, %entry ] ; <i64> [#uses=3]
br label %do.body1
do.body1: ; preds = %do.cond36, %do.body
%indvar1 = phi i64 [ %indvar.next2, %do.cond36 ], [ 0, %do.body ] ; <i64> [#uses=3]
%arrayidx5 = getelementptr [36 x [49 x double]], [36 x [49 x double]]* @C, i64 0, i64 %indvar3, i64 %indvar1 ; <double*> [#uses=2]
br label %do.body2
do.body2: ; preds = %do.cond, %do.body1
%indvar = phi i64 [ %indvar.next, %do.cond ], [ 0, %do.body1 ] ; <i64> [#uses=3]
%arrayidx13 = getelementptr [36 x [49 x double]], [36 x [49 x double]]* @A, i64 0, i64 %indvar3, i64 %indvar ; <double*> [#uses=1]
%arrayidx22 = getelementptr [36 x [49 x double]], [36 x [49 x double]]* @B, i64 0, i64 %indvar, i64 %indvar1 ; <double*> [#uses=1]
%tmp6 = load double, double* %arrayidx5 ; <double> [#uses=1]
%mul = fmul double 1.000000e+00, %tmp6 ; <double> [#uses=1]
%tmp14 = load double, double* %arrayidx13 ; <double> [#uses=1]
%mul15 = fmul double 1.000000e+00, %tmp14 ; <double> [#uses=1]
%tmp23 = load double, double* %arrayidx22 ; <double> [#uses=1]
%mul24 = fmul double %mul15, %tmp23 ; <double> [#uses=1]
%add = fadd double %mul, %mul24 ; <double> [#uses=1]
store double %add, double* %arrayidx5
br label %do.cond
do.cond: ; preds = %do.body2
%indvar.next = add i64 %indvar, 1 ; <i64> [#uses=2]
%exitcond = icmp ne i64 %indvar.next, 36 ; <i1> [#uses=1]
br i1 %exitcond, label %do.body2, label %do.end
do.end: ; preds = %do.cond
br label %do.cond36
do.cond36: ; preds = %do.end
%indvar.next2 = add i64 %indvar1, 1 ; <i64> [#uses=2]
%exitcond5 = icmp ne i64 %indvar.next2, 36 ; <i1> [#uses=1]
br i1 %exitcond5, label %do.body1, label %do.end39
do.end39: ; preds = %do.cond36
br label %do.cond42
do.cond42: ; preds = %do.end39
%indvar.next4 = add i64 %indvar3, 1 ; <i64> [#uses=2]
%exitcond6 = icmp ne i64 %indvar.next4, 36 ; <i1> [#uses=1]
br i1 %exitcond6, label %do.body, label %do.end45
do.end45: ; preds = %do.cond42
fence seq_cst
ret void
}
; VALUE: RAW dependences:
; VALUE-NEXT: { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
; VALUE-NEXT: WAR dependences:
; VALUE-NEXT: { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
; VALUE-NEXT: WAW dependences:
; VALUE-NEXT: { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
; MEMORY: RAW dependences:
; MEMORY-NEXT: { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
; MEMORY-NEXT: WAR dependences:
; MEMORY-NEXT: { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
; MEMORY-NEXT: WAW dependences:
; MEMORY-NEXT: { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
; FUNC-VALUE: RAW dependences:
; FUNC-VALUE-NEXT: { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Write3[]] -> [Stmt_do_body2[i0, i1, 1 + i2] -> Stmt_do_body2_Read0[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
; FUNC-VALUE-NEXT: WAR dependences:
; FUNC-VALUE-NEXT: { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Read0[]] -> [Stmt_do_body2[i0, i1, 1 + i2] -> Stmt_do_body2_Write3[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
; FUNC-VALUE-NEXT: WAW dependences:
; FUNC-VALUE-NEXT: { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Write3[]] -> [Stmt_do_body2[i0, i1, 1 + i2] -> Stmt_do_body2_Write3[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
; FUNC-MEMORY: RAW dependences:
; FUNC-MEMORY-NEXT: { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Write3[]] -> [Stmt_do_body2[i0, i1, o2] -> Stmt_do_body2_Read0[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
; FUNC-MEMORY-NEXT: WAR dependences:
; FUNC-MEMORY-NEXT: { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Read0[]] -> [Stmt_do_body2[i0, i1, o2] -> Stmt_do_body2_Write3[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
; FUNC-MEMORY-NEXT: WAW dependences:
; FUNC-MEMORY-NEXT: { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Write3[]] -> [Stmt_do_body2[i0, i1, o2] -> Stmt_do_body2_Write3[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }

View File

@@ -0,0 +1,75 @@
; RUN: opt %loadPolly -polly-dependences -polly-dependences-analysis-type=value-based -polly-dependences-analysis-level=reference-wise -analyze < %s | FileCheck %s --check-prefix=REF
; RUN: opt %loadPolly -polly-dependences -polly-dependences-analysis-type=value-based -polly-dependences-analysis-level=access-wise -analyze < %s | FileCheck %s --check-prefix=ACC
; RUN: opt %loadPolly -polly-function-dependences -polly-dependences-analysis-type=value-based -polly-dependences-analysis-level=access-wise -analyze < %s | FileCheck %s --check-prefix=ACC
;
; REF: RAW dependences:
; REF-NEXT: [N] -> { Stmt_for_body[i0] -> Stmt_for_body[6 + i0] : 0 <= i0 <= -13 + N; Stmt_for_body[i0] -> Stmt_for_body[4 + i0] : 0 <= i0 <= -11 + N; [Stmt_for_body[i0] -> MemRef_a[]] -> [Stmt_for_body[4 + i0] -> MemRef_a[]] : 0 <= i0 <= -11 + N; [Stmt_for_body[i0] -> MemRef_b[]] -> [Stmt_for_body[6 + i0] -> MemRef_b[]] : 0 <= i0 <= -13 + N }
; REF-NEXT: WAR dependences:
; REF-NEXT: { }
; REF-NEXT: WAW dependences:
; REF-NEXT: { }
; REF-NEXT: Reduction dependences:
; REF-NEXT: { }
; ACC: RAW dependences:
; ACC-NEXT: [N] -> { Stmt_for_body[i0] -> Stmt_for_body[6 + i0] : 0 <= i0 <= -13 + N; Stmt_for_body[i0] -> Stmt_for_body[4 + i0] : 0 <= i0 <= -11 + N; [Stmt_for_body[i0] -> Stmt_for_body_Write1[]] -> [Stmt_for_body[4 + i0] -> Stmt_for_body_Read0[]] : 0 <= i0 <= -11 + N; [Stmt_for_body[i0] -> Stmt_for_body_Write3[]] -> [Stmt_for_body[6 + i0] -> Stmt_for_body_Read2[]] : 0 <= i0 <= -13 + N }
; ACC-NEXT: WAR dependences:
; ACC-NEXT: [N] -> { }
; ACC-NEXT: WAW dependences:
; ACC-NEXT: [N] -> { }
; ACC-NEXT: Reduction dependences:
; ACC-NEXT: [N] -> { }
; void test(char a[], char b[], long N) {
; for (long i = 6; i < N; ++i) {
; a[i] = a[i - 4] + i;
; b[i] = b[i - 6] + i;
; }
; }
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define void @test(i8* %a, i8* %b, i64 %N) #0 {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%i.0 = phi i64 [ 6, %entry ], [ %inc, %for.inc ]
%cmp = icmp slt i64 %i.0, %N
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%sub = sub nsw i64 %i.0, 4
%arrayidx = getelementptr inbounds i8, i8* %a, i64 %sub
%0 = load i8, i8* %arrayidx, align 1
%conv = sext i8 %0 to i64
%add = add nsw i64 %conv, %i.0
%conv1 = trunc i64 %add to i8
%arrayidx2 = getelementptr inbounds i8, i8* %a, i64 %i.0
store i8 %conv1, i8* %arrayidx2, align 1
%sub3 = sub nsw i64 %i.0, 6
%arrayidx4 = getelementptr inbounds i8, i8* %b, i64 %sub3
%1 = load i8, i8* %arrayidx4, align 1
%conv5 = sext i8 %1 to i64
%add6 = add nsw i64 %conv5, %i.0
%conv7 = trunc i64 %add6 to i8
%arrayidx8 = getelementptr inbounds i8, i8* %b, i64 %i.0
store i8 %conv7, i8* %arrayidx8, align 1
br label %for.inc
for.inc: ; preds = %for.body
%inc = add nsw i64 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}
attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.ident = !{!0}
!0 = !{!"clang version 3.9.0 (http://llvm.org/git/clang.git 3d5d4c39659f11dfbe8e11c857cadf5c449b559b) (http://llvm.org/git/llvm.git 801561e2bba12f2aa0285feb1105e110df443761)"}

View File

@@ -0,0 +1,67 @@
; RUN: opt -S %loadPolly -polly-dependences -analyze < %s | FileCheck %s -check-prefix=VALUE
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
; for (int i = 0; i < N; i++) {
; A.must.write.20: A[i] = 20;
;
; compute.i.square: if (i * i)
; A.may.write.90: A[i] = 90;
;
; B.write.from.A: B[i] = A[i];
; A.must.write.42: A[i] = 42;
; }
define void @f(i32* %A, i32* %B) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%exitcond = icmp ne i64 %indvars.iv, 3000
br i1 %exitcond, label %A.must.write.20, label %for.end
A.must.write.20:
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
store i32 20, i32* %arrayidx, align 4
br label %compute.i.square
compute.i.square:
%tmp = mul nsw i64 %indvars.iv, %indvars.iv
%tmp2 = trunc i64 %tmp to i32
%tobool = icmp eq i32 %tmp2, 0
br i1 %tobool, label %B.write.from.A, label %A.may.write.90
A.may.write.90:
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
store i32 90, i32* %arrayidx2, align 4
br label %B.write.from.A
B.write.from.A:
%arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
%tmp3 = load i32, i32* %arrayidx4, align 4
%arrayidx6 = getelementptr inbounds i32, i32* %B, i64 %indvars.iv
store i32 %tmp3, i32* %arrayidx6, align 4
br label %A.must.write.42
; br label %for.inc
A.must.write.42:
%arrayidx5 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
store i32 42, i32* %arrayidx5, align 4
br label %for.inc
for.inc: ; preds = %if.end
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}
; VALUE: RAW dependences:
; VALUE-NEXT: { Stmt_A_must_write_20[i0] -> Stmt_B_write_from_A[i0] : 0 <= i0 <= 2999; Stmt_compute_i_square__TO__B_write_from_A[i0] -> Stmt_B_write_from_A[i0] : 0 <= i0 <= 2999 }
; VALUE-NEXT: WAR dependences:
; VALUE-NEXT: { Stmt_B_write_from_A[i0] -> Stmt_A_must_write_42[i0] : 0 <= i0 <= 2999 }
; VALUE-NEXT: WAW dependences:
; VALUE-NEXT: { Stmt_compute_i_square__TO__B_write_from_A[i0] -> Stmt_A_must_write_42[i0] : 0 <= i0 <= 2999; Stmt_A_must_write_20[i0] -> Stmt_A_must_write_42[i0] : 0 <= i0 <= 2999; Stmt_A_must_write_20[i0] -> Stmt_compute_i_square__TO__B_write_from_A[i0] : 0 <= i0 <= 2999 }
; VALUE-NEXT: Reduction dependences:
; VALUE-NEXT: { }
; VALUE-NEXT: Transitive closure of reduction dependences:
; VALUE-NEXT: { }

View File

@@ -0,0 +1,69 @@
; RUN: opt %loadPolly -polly-function-scops -analyze < %s \
; RUN: | FileCheck %s -check-prefix=FUNC-SCOP
; RUN: opt %loadPolly -polly-function-dependences -analyze < %s \
; RUN: | FileCheck %s -check-prefix=FUNC-DEPS
;
; FUNC-SCOP-NOT: Statement
; FUNC-DEPS-LABEL: Printing analysis 'Polly - Calculate dependences for all the SCoPs of a function' for function 'readgeo'
; FUNC-DEPS-NOT: RAW dependences
;
; Due to an infeasible run-time check, scop object is empty and we do not compute dependences.
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
%struct.tnode.1.7.13.67.121.175.217.307.325.337.349.367.379.391.433.445.667.727.733.739 = type { i32, i32, %struct.tnode.1.7.13.67.121.175.217.307.325.337.349.367.379.391.433.445.667.727.733.739*, %struct.tnode.1.7.13.67.121.175.217.307.325.337.349.367.379.391.433.445.667.727.733.739*, %struct.tnode.1.7.13.67.121.175.217.307.325.337.349.367.379.391.433.445.667.727.733.739*, %struct.tnode.1.7.13.67.121.175.217.307.325.337.349.367.379.391.433.445.667.727.733.739*, %struct.tnode.1.7.13.67.121.175.217.307.325.337.349.367.379.391.433.445.667.727.733.739*, i32, i32, %struct.plist.0.6.12.66.120.174.216.306.324.336.348.366.378.390.432.444.666.726.732.738* }
%struct.plist.0.6.12.66.120.174.216.306.324.336.348.366.378.390.432.444.666.726.732.738 = type { i32, %struct.plist.0.6.12.66.120.174.216.306.324.336.348.366.378.390.432.444.666.726.732.738* }
@vFixedEdgeRoot = external global %struct.tnode.1.7.13.67.121.175.217.307.325.337.349.367.379.391.433.445.667.727.733.739*, align 8
@hEdgeRoot = external global %struct.tnode.1.7.13.67.121.175.217.307.325.337.349.367.379.391.433.445.667.727.733.739*, align 8
; Function Attrs: nounwind uwtable
define void @readgeo() #0 {
entry:
%vx = alloca i32, align 4
br label %if.end64
if.end64: ; preds = %entry
br label %for.body73
for.body73: ; preds = %for.inc216, %if.end64
%v.0101 = phi i32 [ 0, %for.inc216 ], [ 1, %if.end64 ]
br i1 undef, label %if.then93, label %if.else
if.then93: ; preds = %for.body73
br label %for.inc216
if.else: ; preds = %for.body73
br i1 undef, label %if.then111, label %if.end116
if.then111: ; preds = %if.else
br label %if.end116
if.end116: ; preds = %if.then111, %if.else
%rippleCount.2 = phi i32 [ 1, %if.then111 ], [ undef, %if.else ]
%rem11790 = and i32 %v.0101, 1
%cmp118 = icmp eq i32 %rem11790, 0
br i1 %cmp118, label %if.then120, label %if.else154
if.then120: ; preds = %if.end116
call void @tinsert()
br label %if.end193
if.else154: ; preds = %if.end116
call void @tinsert()
br label %if.end193
if.end193: ; preds = %if.else154, %if.then120
%0 = load i32, i32* %vx, align 4
br label %for.inc216
for.inc216: ; preds = %if.end193, %if.then93
%rippleCount.3 = phi i32 [ undef, %if.then93 ], [ %rippleCount.2, %if.end193 ]
%ux.2 = phi i32 [ undef, %if.then93 ], [ %0, %if.end193 ]
br i1 undef, label %for.body73, label %for.end218
for.end218: ; preds = %for.inc216
unreachable
}
declare void @tinsert()

View File

@@ -0,0 +1,73 @@
; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
;
; Verify that the presence of a may-write (S1) between a read (S0) and a
; must-write (S2) does not block the generation of RAW dependences. This makes
; sure that we capture as many RAW dependences as possible.
;
; For this example, we want both (S0(Read) -> S1 (May-Write)) as well as
; (S0(Read) -> S2(Must-Write)).
;
; CHECK: WAR dependences:
; CHECK-NEXT: { Stmt_S0[i0] -> Stmt_S2[i0] : 0 < i0 <= 2; Stmt_S0[i0] -> Stmt_if_end__TO__S2[i0] : 0 < i0 <= 2 }
;
;
; static const int N = 3000;
;
; void f(int *sum, int *A, int *B, int *out) {
; for (int i = 0; i <= 2; i++) {
; if (i) {
; S0: *out += *sum;
; }
;
; if (i * i) {
; S1: *sum = *A;
; }
; S2: *sum = *B;
; }
; }
;
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
define void @f(i32* %sum, i32* %A, i32* %B, i32* %out) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %i.0, 3
br i1 %exitcond, label %for.body, label %for.end
for.body: ; preds = %for.cond
%tobool = icmp eq i32 %i.0, 0
br i1 %tobool, label %if.end, label %S0
S0: ; preds = %for.body
%tmp = load i32, i32* %sum, align 4
%tmp1 = load i32, i32* %out, align 4
%add = add nsw i32 %tmp1, %tmp
store i32 %add, i32* %out, align 4
br label %if.end
if.end: ; preds = %for.body, %S0
%mul = mul nsw i32 %i.0, %i.0
%tobool1 = icmp eq i32 %mul, 0
br i1 %tobool1, label %S2, label %S1
S1: ; preds = %if.end
%tmp2 = load i32, i32* %A, align 4
store i32 %tmp2, i32* %sum, align 4
br label %S2
S2: ; preds = %if.end, %S1
%tmp3 = load i32, i32* %B, align 4
store i32 %tmp3, i32* %sum, align 4
br label %for.inc
for.inc: ; preds = %S2
%inc = add nuw nsw i32 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,74 @@
; RUN: opt %loadPolly -polly-codegen -polly-allow-nonaffine-loops -polly-allow-nonaffine -debug-only=polly-dependence < %s 2>&1 | FileCheck %s
; REQUIRES: asserts
; CHECK: MayWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_for_body__TO__for_inc11[i0] -> MemRef_A[o0] : 0 <= o0 <= 699 };
; CHECK-NEXT: MayWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_for_body__TO__for_inc11[i0] -> MemRef_B[700] };
; The if condition C[i] is a non-affine condition, which make the nested loop boxed. The memory access for A should be a range A[0...699]. The memory access for B should be simplified to B[700].
;
; int A[1000], B[1000], C[1000];
;
; void foo(int n, int m, int N) {
; for (int i = 0; i < 500; i+=1) { /* affine loop */
; C[i] += i;
; if (C[i]) { /* non-affine subregion */
; int j;
; for (j = 0; j < 700; j+=1) { /* boxed loop */
; A[j] = 1;
; }
; B[j] = 2;
; }
; }
; }
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
@C = common global [1000 x i32] zeroinitializer, align 4
@A = common global [1000 x i32] zeroinitializer, align 4
@B = common global [1000 x i32] zeroinitializer, align 4
; Function Attrs: norecurse nounwind
define void @foo(i32 %n, i32 %m, i32 %N) #0 {
entry:
br label %entry.split
entry.split: ; preds = %entry
br label %for.body
for.cond.cleanup: ; preds = %for.inc11
ret void
for.body: ; preds = %for.inc11, %entry.split
%indvars.iv25 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next26, %for.inc11 ]
%arrayidx = getelementptr inbounds [1000 x i32], [1000 x i32]* @C, i64 0, i64 %indvars.iv25
%0 = load i32, i32* %arrayidx, align 4
%1 = trunc i64 %indvars.iv25 to i32
%add = add nsw i32 %0, %1
store i32 %add, i32* %arrayidx, align 4
%tobool = icmp eq i32 %add, 0
br i1 %tobool, label %for.inc11, label %for.body5.preheader
for.body5.preheader: ; preds = %for.body
br label %for.body5
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ 0, %for.body5.preheader ]
%arrayidx7 = getelementptr inbounds [1000 x i32], [1000 x i32]* @A, i64 0, i64 %indvars.iv
store i32 1, i32* %arrayidx7, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond = icmp eq i64 %indvars.iv, 699
br i1 %exitcond, label %for.end, label %for.body5
for.end: ; preds = %for.body5
store i32 2, i32* getelementptr inbounds ([1000 x i32], [1000 x i32]* @B, i64 0, i64 700), align 4
br label %for.inc11
for.inc11: ; preds = %for.body, %for.end
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
%exitcond27 = icmp eq i64 %indvars.iv25, 499
br i1 %exitcond27, label %for.cond.cleanup, label %for.body
}

View File

@@ -0,0 +1,61 @@
; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
; RUN: opt %loadPolly -polly-dependences -polly-dependences-analysis-level=reference-wise -analyze < %s | FileCheck %s
; RUN: opt %loadPolly -polly-dependences -polly-dependences-analysis-level=access-wise -analyze < %s | FileCheck %s
;
; CHECK: RAW dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: WAR dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: WAW dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: Reduction dependences:
; CHECK-NEXT: { Stmt_for_body3[i0, i1] -> Stmt_for_body3[2 + i0, -1 + i1] : 0 <= i0 <= 97 and 0 < i1 <= 99 }
;
; void f(int *sum) {
; for (int i = 0; i < 100; i++)
; for (int j = 0; j < 100; j++)
; sum[i+j*2] += j * i;
; }
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f(i32* %sum) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc6, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc7, %for.inc6 ]
%exitcond1 = icmp ne i32 %i.0, 100
br i1 %exitcond1, label %for.body, label %for.end8
for.body: ; preds = %for.cond
br label %for.cond1
for.cond1: ; preds = %for.inc, %for.body
%j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %j.0, 100
br i1 %exitcond, label %for.body3, label %for.end
for.body3: ; preds = %for.cond1
%mul = mul nsw i32 %j.0, %i.0
%mul4 = shl nsw i32 %j.0, 1
%add = add nsw i32 %i.0, %mul4
%arrayidx = getelementptr inbounds i32, i32* %sum, i32 %add
%tmp = load i32, i32* %arrayidx, align 4
%add5 = add nsw i32 %tmp, %mul
store i32 %add5, i32* %arrayidx, align 4
br label %for.inc
for.inc: ; preds = %for.body3
%inc = add nsw i32 %j.0, 1
br label %for.cond1
for.end: ; preds = %for.cond1
br label %for.inc6
for.inc6: ; preds = %for.end
%inc7 = add nsw i32 %i.0, 1
br label %for.cond
for.end8: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,62 @@
; RUN: opt %loadPolly -basicaa -polly-dependences -analyze < %s | FileCheck %s
;
; This loopnest contains a reduction which imposes the same dependences as the
; accesses to the array A. We need to ensure we keep the dependences of A.
;
; CHECK: RAW dependences:
; CHECK-NEXT: { Stmt_for_body[i0] -> Stmt_for_body[1 + i0] : 0 <= i0 <= 1022 }
; CHECK-NEXT: WAR dependences:
; CHECK-NEXT: { Stmt_for_body[i0] -> Stmt_for_body[1 + i0] : 0 <= i0 <= 1022 }
; CHECK-NEXT: WAW dependences:
; CHECK-NEXT: { Stmt_for_body[i0] -> Stmt_for_body[1 + i0] : 0 <= i0 <= 1022 }
; CHECK-NEXT: Reduction dependences:
; CHECK-NEXT: { Stmt_for_body[i0] -> Stmt_for_body[1 + i0] : 0 <= i0 <= 1022 }
;
;
; void AandSum(int *restrict sum, int *restrict A) {
; for (int i = 0; i < 1024; i++) {
; A[i] = A[i] + A[i - 1];
; A[i - 1] = A[i] + A[i - 2];
; *sum += i;
; }
; }
;
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @AandSum(i32* noalias %sum, i32* noalias %A) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %i.0, 1024
br i1 %exitcond, label %for.body, label %for.end
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.0
%tmp = load i32, i32* %arrayidx, align 4
%sub = add nsw i32 %i.0, -1
%arrayidx1 = getelementptr inbounds i32, i32* %A, i32 %sub
%tmp1 = load i32, i32* %arrayidx1, align 4
%add = add nsw i32 %tmp, %tmp1
%arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %i.0
store i32 %add, i32* %arrayidx2, align 4
%sub4 = add nsw i32 %i.0, -2
%arrayidx5 = getelementptr inbounds i32, i32* %A, i32 %sub4
%tmp2 = load i32, i32* %arrayidx5, align 4
%add6 = add nsw i32 %add, %tmp2
%sub7 = add nsw i32 %i.0, -1
%arrayidx8 = getelementptr inbounds i32, i32* %A, i32 %sub7
store i32 %add6, i32* %arrayidx8, align 4
%tmp3 = load i32, i32* %sum, align 4
%add9 = add nsw i32 %tmp3, %i.0
store i32 %add9, i32* %sum, align 4
br label %for.inc
for.inc: ; preds = %for.body
%inc = add nsw i32 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,34 @@
; Test that the reduction dependences are always initialised, even in a case
; where we have no reduction. If this object is NULL, then isl operations on
; it will fail.
; RUN: opt -S %loadPolly -polly-dependences -analyze < %s | FileCheck %s -check-prefix=VALUE
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
; for(i = 0; i < 100; i++ )
; S1: A[i] = 2;
define void @sequential_writes() {
entry:
%A = alloca [200 x i32]
br label %S1
S1:
%indvar.1 = phi i64 [ 0, %entry ], [ %indvar.next.1, %S1 ]
%arrayidx.1 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.1
store i32 2, i32* %arrayidx.1
%indvar.next.1 = add i64 %indvar.1, 1
%exitcond.1 = icmp ne i64 %indvar.next.1, 100
br i1 %exitcond.1, label %S1, label %exit.1
exit.1:
ret void
}
; VALUE: RAW dependences:
; VALUE-NEXT: { }
; VALUE-NEXT: WAR dependences:
; VALUE-NEXT: { }
; VALUE-NEXT: WAW dependences:
; VALUE-NEXT: { }
; VALUE-NEXT: Reduction dependences:
; VALUE-NEXT: { }

View File

@@ -0,0 +1,58 @@
; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
;
; CHECK: RAW dependences:
; CHECK-NEXT: { Stmt_for_body3[i0, i1] -> Stmt_for_body3[i0 + i1, o1] : i0 >= 0 and 0 <= i1 <= 1023 - i0 and i1 <= 1 and 0 < o1 <= 511 }
; CHECK-NEXT: WAR dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: WAW dependences:
; CHECK-NEXT: { Stmt_for_body3[i0, i1] -> Stmt_for_body3[1 + i0, -1 + i1] : 0 <= i0 <= 1022 and 2 <= i1 <= 511; Stmt_for_body3[i0, 2] -> Stmt_for_body3[2 + i0, 0] : 0 <= i0 <= 1021 }
; CHECK-NEXT: Reduction dependences:
; CHECK-NEXT: { Stmt_for_body3[i0, 1] -> Stmt_for_body3[1 + i0, 0] : 0 <= i0 <= 1022 }
;
; void f(int *sum) {
; for (int i = 0; i < 1024; i++)
; for (int j = 0; j < 512; j++)
; sum[i + j] = sum[i] + 3;
; }
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f(i32* %sum) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc6, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc7, %for.inc6 ]
%exitcond1 = icmp ne i32 %i.0, 1024
br i1 %exitcond1, label %for.body, label %for.end8
for.body: ; preds = %for.cond
br label %for.cond1
for.cond1: ; preds = %for.inc, %for.body
%j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %j.0, 512
br i1 %exitcond, label %for.body3, label %for.end
for.body3: ; preds = %for.cond1
%arrayidx = getelementptr inbounds i32, i32* %sum, i32 %i.0
%tmp = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %tmp, 3
%add4 = add nsw i32 %i.0, %j.0
%arrayidx5 = getelementptr inbounds i32, i32* %sum, i32 %add4
store i32 %add, i32* %arrayidx5, align 4
br label %for.inc
for.inc: ; preds = %for.body3
%inc = add nsw i32 %j.0, 1
br label %for.cond1
for.end: ; preds = %for.cond1
br label %for.inc6
for.inc6: ; preds = %for.end
%inc7 = add nsw i32 %i.0, 1
br label %for.cond
for.end8: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,79 @@
; RUN: opt -basicaa %loadPolly -polly-dependences -analyze < %s | FileCheck %s
; RUN: opt -basicaa %loadPolly -polly-dependences -polly-dependences-analysis-level=reference-wise -analyze < %s | FileCheck %s
; RUN: opt -basicaa %loadPolly -polly-dependences -polly-dependences-analysis-level=access-wise -analyze < %s | FileCheck %s
;
; Verify that only the inner reduction like accesses cause reduction dependences
;
; CHECK: Reduction dependences:
; CHECK-NEXT: { Stmt_for_body3[i0, i1] -> Stmt_for_body3[i0, 1 + i1] : 0 <= i0 <= 99 and 0 <= i1 <= 98 }
;
; void f(int * restrict A, int * restrict sum) {
; int i, j, k;
; for (i = 0; i < 100; i++) {
; *sum *= 7;
; for (j = 0; j < 100; j++) {
; *sum += A[i+j];
; for (k = 0; k< 100; k++) {}
; }
; }
; }
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f(i32* noalias %A, i32* noalias %sum) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc11, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc11 ]
%exitcond2 = icmp ne i32 %i.0, 100
br i1 %exitcond2, label %for.body, label %for.end13
for.body: ; preds = %for.cond
%tmp = load i32, i32* %sum, align 4
%mul = mul nsw i32 %tmp, 7
store i32 %mul, i32* %sum, align 4
br label %for.cond1
for.cond1: ; preds = %for.inc8, %for.body
%j.0 = phi i32 [ 0, %for.body ], [ %inc9, %for.inc8 ]
%exitcond1 = icmp ne i32 %j.0, 100
br i1 %exitcond1, label %for.body3, label %for.end10
for.body3: ; preds = %for.cond1
%add = add nsw i32 %i.0, %j.0
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %add
%tmp3 = load i32, i32* %arrayidx, align 4
%tmp4 = load i32, i32* %sum, align 4
%add4 = add nsw i32 %tmp4, %tmp3
store i32 %add4, i32* %sum, align 4
br label %for.cond5
for.cond5: ; preds = %for.inc, %for.body3
%k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %k.0, 100
br i1 %exitcond, label %for.body7, label %for.end
for.body7: ; preds = %for.cond5
br label %for.inc
for.inc: ; preds = %for.body7
%inc = add nsw i32 %k.0, 1
br label %for.cond5
for.end: ; preds = %for.cond5
br label %for.inc8
for.inc8: ; preds = %for.end
%inc9 = add nsw i32 %j.0, 1
br label %for.cond1
for.end10: ; preds = %for.cond1
br label %for.inc11
for.inc11: ; preds = %for.end10
%inc12 = add nsw i32 %i.0, 1
br label %for.cond
for.end13: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,78 @@
; RUN: opt %loadPolly -polly-dependences -analyze -basicaa < %s | FileCheck %s
;
; CHECK: RAW dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: WAR dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: WAW dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: Reduction dependences:
; CHECK-NEXT: { Stmt_for_body3[i0, i1] -> Stmt_for_body3[i0, 1 + i1] : 0 <= i0 <= 99 and 0 <= i1 <= 98; Stmt_for_body3[i0, 99] -> Stmt_for_body3[1 + i0, 0] : 0 <= i0 <= 98 }
;
; int f(int * restrict A, int * restrict sum) {
; int i, j, k;
; for (i = 0; i < 100; i++) {
; for (j = 0; j < 100; j++) {
; sum += A[i+j];
; for (k = 0; k< 100; k++) {}
; }
; }
; return sum;
; }
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f(i32* noalias %A, i32* noalias %sum) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc11, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc11 ]
%exitcond2 = icmp ne i32 %i.0, 100
br i1 %exitcond2, label %for.body, label %for.end13
for.body: ; preds = %for.cond
br label %for.cond1
for.cond1: ; preds = %for.inc8, %for.body
%j.0 = phi i32 [ 0, %for.body ], [ %inc9, %for.inc8 ]
%exitcond1 = icmp ne i32 %j.0, 100
br i1 %exitcond1, label %for.body3, label %for.end10
for.body3: ; preds = %for.cond1
%add = add nsw i32 %i.0, %j.0
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %add
%tmp3 = load i32, i32* %arrayidx, align 4
%tmp4 = load i32, i32* %sum, align 4
%add4 = add nsw i32 %tmp4, %tmp3
store i32 %add4, i32* %sum, align 4
br label %for.cond5
for.cond5: ; preds = %for.inc, %for.body3
%k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %k.0, 100
br i1 %exitcond, label %for.body7, label %for.end
for.body7: ; preds = %for.cond5
br label %for.inc
for.inc: ; preds = %for.body7
%inc = add nsw i32 %k.0, 1
br label %for.cond5
for.end: ; preds = %for.cond5
br label %for.inc8
for.inc8: ; preds = %for.end
%inc9 = add nsw i32 %j.0, 1
br label %for.cond1
for.end10: ; preds = %for.cond1
br label %for.inc11
for.inc11: ; preds = %for.end10
%inc12 = add nsw i32 %i.0, 1
br label %for.cond
for.end13: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,73 @@
; RUN: opt %loadPolly -polly-dependences -analyze -basicaa < %s | FileCheck %s
;
; CHECK: Reduction dependences:
; CHECK-NEXT: { Stmt_for_inc[i0, i1] -> Stmt_for_inc[i0, 1 + i1] : 0 <= i0 <= 99 and 0 <= i1 <= 98 }
;
; int f(int * __restrict__ A) {
; int i, j, sum = 0;
; for (k = 0; k < 37; k = g(k)) {
; for (i = 0; i < 100; i++) {
; sum *= 2;
; for (j = 0; j < 100; j++) {
; sum += A[i+j];
; }
; }
; }
; return sum;
; }
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
declare i64 @g(i64)
define i32 @f(i32* noalias %A) {
entry:
%sum.04.reg2mem = alloca i32
%sum.12.reg2mem = alloca i32
br label %entry.split
entry.split: ; preds = %entry
store i32 0, i32* %sum.04.reg2mem
br label %for.body_outer_split
for.body_outer_split: ; preds = %entry.split, %for.inc5
%indvars.ivK = phi i64 [ 0, %entry.split ], [ %incK, %for.bos2 ]
br label %for.body_outer
for.body_outer: ; preds = %for.body_outer_split
%incK = call i64 @g(i64 %indvars.ivK)
%exitcondK = icmp eq i64 %incK, 100
br i1 %exitcondK, label %for.end7, label %for.body
for.body: ; preds = %for.inc5, %for.body_outer
%indvars.iv23 = phi i64 [ 0, %for.body_outer ], [ %3, %for.inc5 ]
%sum.04.reload = load i32, i32* %sum.04.reg2mem
%mul = shl nsw i32 %sum.04.reload, 1
store i32 %mul, i32* %sum.12.reg2mem
br label %for.inc
for.inc: ; preds = %for.inc, %for.body
%indvars.iv1 = phi i64 [ 0, %for.body ], [ %1, %for.inc ]
%sum.12.reload = load i32, i32* %sum.12.reg2mem
%0 = add i64 %indvars.iv23, %indvars.iv1
%arrayidx = getelementptr i32, i32* %A, i64 %0
%tmp5 = load i32, i32* %arrayidx, align 4
%add4 = add nsw i32 %tmp5, %sum.12.reload
%1 = add nuw nsw i64 %indvars.iv1, 1
%exitcond1 = icmp eq i64 %1, 100
store i32 %add4, i32* %sum.12.reg2mem
br i1 %exitcond1, label %for.inc5, label %for.inc
for.inc5: ; preds = %for.inc
%2 = load i32, i32* %sum.12.reg2mem
%3 = add nuw nsw i64 %indvars.iv23, 1
%exitcond2 = icmp eq i64 %3, 100
store i32 %2, i32* %sum.04.reg2mem
br i1 %exitcond2, label %for.bos2, label %for.body
for.bos2:
br label %for.body_outer_split
for.end7: ; preds = %for.inc5
%4 = load i32, i32* %sum.04.reg2mem
ret i32 %4
}

View File

@@ -0,0 +1,58 @@
; RUN: opt %loadPolly -basicaa -polly-dependences -analyze < %s | FileCheck %s
;
; Verify we do not have dependences between the if and the else clause
;
; CHECK: RAW dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: WAR dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: WAW dependences:
; CHECK-NEXT: { }
; CHECK-NEXT: Reduction dependences:
; CHECK-NEXT: { Stmt_if_then[i0] -> Stmt_if_then[1 + i0] : 0 <= i0 <= 510; Stmt_if_else[i0] -> Stmt_if_else[1 + i0] : 512 <= i0 <= 1022 }
;
; void f(int *restrict sum, int *restrict prod) {
; for (int i = 0; i < 1024; i++)
; if (i < 512)
; *sum += i;
; else
; *prod *= i;
; }
;
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f(i32* noalias %sum, i32* noalias %prod) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %i.0, 1024
br i1 %exitcond, label %for.body, label %for.end
for.body: ; preds = %for.cond
%cmp1 = icmp slt i32 %i.0, 512
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %for.body
%tmp = load i32, i32* %sum, align 4
%add = add nsw i32 %tmp, %i.0
store i32 %add, i32* %sum, align 4
br label %if.end
if.else: ; preds = %for.body
%tmp1 = load i32, i32* %prod, align 4
%mul = mul nsw i32 %tmp1, %i.0
store i32 %mul, i32* %prod, align 4
br label %if.end
if.end: ; preds = %if.else, %if.then
br label %for.inc
for.inc: ; preds = %if.end
%inc = add nsw i32 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,108 @@
; RUN: opt %loadPolly -basicaa -polly-dependences -analyze < %s | FileCheck %s
;
;
; These are the important RAW dependences, as they need to originate/end in only one iteration:
; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1]
; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0]
;
; These are the important WAW dependences, as they need to originate/end in only one iteration:
; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1]
; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0]
;
; CHECK: RAW dependences:
; CHECK-NEXT: { Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }
; CHECK-NEXT: WAR dependences:
; CHECK-NEXT: { Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }
; CHECK-NEXT: WAW dependences:
; CHECK-NEXT: { Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }
; CHECK-NEXT: Reduction dependences:
; CHECK-NEXT: { Stmt_S1[i0, i1] -> Stmt_S1[i0, 1 + i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S2[i0, 1 + i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }
;
; void f(int *restrict red) {
; for (int j = 0; j < 1024; j++) {
; S0: *red = 42 + *red * 5;
; for (int i = 0; i < 1024; i++)
; S1: *red *= i;
; for (int i = 0; i < 1024; i++)
; S2: *red += i;
; S3: *red = 42 + *red * 7;
; }
; }
;
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f(i32* noalias %red) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc15, %entry
%j.0 = phi i32 [ 0, %entry ], [ %inc16, %for.inc15 ]
%exitcond2 = icmp ne i32 %j.0, 1024
br i1 %exitcond2, label %for.body, label %for.end17
for.body: ; preds = %for.cond
br label %S0
S0: ; preds = %for.body
%tmp = load i32, i32* %red, align 4
%mul = mul nsw i32 %tmp, 5
%add = add nsw i32 %mul, 42
store i32 %add, i32* %red, align 4
br label %for.cond1
for.cond1: ; preds = %for.inc, %S0
%i.0 = phi i32 [ 0, %S0 ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %i.0, 1024
br i1 %exitcond, label %for.body3, label %for.end
for.body3: ; preds = %for.cond1
br label %S1
S1: ; preds = %for.body3
%tmp3 = load i32, i32* %red, align 4
%mul4 = mul nsw i32 %tmp3, %i.0
store i32 %mul4, i32* %red, align 4
br label %for.inc
for.inc: ; preds = %S1
%inc = add nsw i32 %i.0, 1
br label %for.cond1
for.end: ; preds = %for.cond1
br label %for.cond6
for.cond6: ; preds = %for.inc10, %for.end
%i5.0 = phi i32 [ 0, %for.end ], [ %inc11, %for.inc10 ]
%exitcond1 = icmp ne i32 %i5.0, 1024
br i1 %exitcond1, label %for.body8, label %for.end12
for.body8: ; preds = %for.cond6
br label %S2
S2: ; preds = %for.body8
%tmp4 = load i32, i32* %red, align 4
%add9 = add nsw i32 %tmp4, %i5.0
store i32 %add9, i32* %red, align 4
br label %for.inc10
for.inc10: ; preds = %S2
%inc11 = add nsw i32 %i5.0, 1
br label %for.cond6
for.end12: ; preds = %for.cond6
br label %S3
S3: ; preds = %for.end12
%tmp5 = load i32, i32* %red, align 4
%mul13 = mul nsw i32 %tmp5, 7
%add14 = add nsw i32 %mul13, 42
store i32 %add14, i32* %red, align 4
br label %for.inc15
for.inc15: ; preds = %S3
%inc16 = add nsw i32 %j.0, 1
br label %for.cond
for.end17: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,44 @@
; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
;
; FIXME: Change the comment once we allow different pointers
; The statement is "almost" reduction like but should not yield any reduction dependences
;
; We are limited to binary reductions at the moment and this is not one.
; There are never at least two iterations which read __and__ write to the same
; location, thus we won't find the RAW and WAW dependences of a reduction,
; thus we should not find Reduction dependences.
;
; CHECK: Reduction dependences:
; CHECK: { }
;
; void f(int *sum) {
; for (int i = 0; i < 100; i++)
; sum[i] = sum[99-i] + i;
; }
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f(i32* %sum) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %i.0, 100
br i1 %exitcond, label %for.body, label %for.end
for.body: ; preds = %for.cond
%sub = sub nsw i32 99, %i.0
%arrayidx = getelementptr inbounds i32, i32* %sum, i32 %sub
%tmp = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %tmp, %i.0
%arrayidx1 = getelementptr inbounds i32, i32* %sum, i32 %i.0
store i32 %add, i32* %arrayidx1, align 4
br label %for.inc
for.inc: ; preds = %for.body
%inc = add nsw i32 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,69 @@
; RUN: opt %loadPolly -polly-dependences -analyze -basicaa < %s | FileCheck %s
;
; CHECK: Reduction dependences:
; CHECK-NEXT: [N] -> { Stmt_for_body3[i0, i1] -> Stmt_for_body3[i0, 1 + i1] : 0 <= i0 <= 1023 and i1 >= 0 and 1024 - N + i0 <= i1 <= 1022 }
;
; void f(int N, int * restrict sums, int * restrict escape) {
; for (int i = 0; i < 1024; i++) {
; for (int j = 0; j < 1024; j++) {
; sums[i] += 5;
; if (N - i + j < 1024)
; escape[N - i + j] = sums[i];
; }
; }
; }
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f(i32 %N, i32* noalias %sums, i32* noalias %escape) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc10, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc11, %for.inc10 ]
%exitcond1 = icmp ne i32 %i.0, 1024
br i1 %exitcond1, label %for.body, label %for.end12
for.body: ; preds = %for.cond
br label %for.cond1
for.cond1: ; preds = %for.inc, %for.body
%j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
%exitcond = icmp ne i32 %j.0, 1024
br i1 %exitcond, label %for.body3, label %for.end
for.body3: ; preds = %for.cond1
%arrayidx = getelementptr inbounds i32, i32* %sums, i32 %i.0
%tmp = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %tmp, 5
store i32 %add, i32* %arrayidx, align 4
%sub = sub nsw i32 %N, %i.0
%add4 = add nsw i32 %sub, %j.0
%cmp5 = icmp slt i32 %add4, 1024
br i1 %cmp5, label %if.then, label %if.end
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds i32, i32* %sums, i32 %i.0
%tmp2 = load i32, i32* %arrayidx6, align 4
%sub7 = sub nsw i32 %N, %i.0
%add8 = add nsw i32 %sub7, %j.0
%arrayidx9 = getelementptr inbounds i32, i32* %escape, i32 %add8
store i32 %tmp2, i32* %arrayidx9, align 4
br label %if.end
if.end: ; preds = %if.then, %for.body3
br label %for.inc
for.inc: ; preds = %if.end
%inc = add nsw i32 %j.0, 1
br label %for.cond1
for.end: ; preds = %for.cond1
br label %for.inc10
for.inc10: ; preds = %for.end
%inc11 = add nsw i32 %i.0, 1
br label %for.cond
for.end12: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,108 @@
; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
;
; CHECK: RAW dependences:
; CHECK-NEXT: { Stmt_S0[i0] -> Stmt_S1[o0, i0 - o0] : i0 <= 1023 and 0 <= o0 <= i0; Stmt_S1[i0, i1] -> Stmt_S2[-1 + i0 + i1] : 0 <= i0 <= 1023 and i1 >= 0 and -i0 < i1 <= 1024 - i0 and i1 <= 1023 }
; CHECK-NEXT: WAR dependences:
; CHECK-NEXT: { Stmt_S2[i0] -> Stmt_S2[1 + i0] : 0 <= i0 <= 1022; Stmt_S1[i0, i1] -> Stmt_S2[i0 + i1] : i0 >= 0 and 0 <= i1 <= 1023 - i0 }
; CHECK-NEXT: WAW dependences:
; CHECK-NEXT: { Stmt_S0[i0] -> Stmt_S1[o0, i0 - o0] : i0 <= 1023 and 0 <= o0 <= i0; Stmt_S1[i0, i1] -> Stmt_S2[i0 + i1] : i0 >= 0 and 0 <= i1 <= 1023 - i0 }
; CHECK-NEXT: Reduction dependences:
; CHECK-NEXT: { Stmt_S1[i0, i1] -> Stmt_S1[1 + i0, -1 + i1] : 0 <= i0 <= 1022 and 0 < i1 <= 1023 }
;
; void f(int *sum) {
; for (int i = 0; i < 1024; i++)
; S0: sum[i] = 0;
; for (int i = 0; i < 1024; i++)
; for (int j = 0; j < 1024; j++)
; S1: sum[i + j] += i;
; for (int i = 0; i < 1024; i++)
; S2: sum[i] = sum[i + 1] * 3;
; }
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f(i32* %sum) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
%exitcond3 = icmp ne i32 %i.0, 1024
br i1 %exitcond3, label %for.body, label %for.end
for.body: ; preds = %for.cond
br label %S0
S0: ; preds = %for.body
%arrayidx = getelementptr inbounds i32, i32* %sum, i32 %i.0
store i32 0, i32* %arrayidx, align 4
br label %for.inc
for.inc: ; preds = %S0
%inc = add nsw i32 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
br label %for.cond2
for.cond2: ; preds = %for.inc13, %for.end
%i1.0 = phi i32 [ 0, %for.end ], [ %inc14, %for.inc13 ]
%exitcond2 = icmp ne i32 %i1.0, 1024
br i1 %exitcond2, label %for.body4, label %for.end15
for.body4: ; preds = %for.cond2
br label %for.cond5
for.cond5: ; preds = %for.inc10, %for.body4
%j.0 = phi i32 [ 0, %for.body4 ], [ %inc11, %for.inc10 ]
%exitcond1 = icmp ne i32 %j.0, 1024
br i1 %exitcond1, label %for.body7, label %for.end12
for.body7: ; preds = %for.cond5
br label %S1
S1: ; preds = %for.body7
%add = add nsw i32 %i1.0, %j.0
%arrayidx8 = getelementptr inbounds i32, i32* %sum, i32 %add
%tmp = load i32, i32* %arrayidx8, align 4
%add9 = add nsw i32 %tmp, %i1.0
store i32 %add9, i32* %arrayidx8, align 4
br label %for.inc10
for.inc10: ; preds = %S1
%inc11 = add nsw i32 %j.0, 1
br label %for.cond5
for.end12: ; preds = %for.cond5
br label %for.inc13
for.inc13: ; preds = %for.end12
%inc14 = add nsw i32 %i1.0, 1
br label %for.cond2
for.end15: ; preds = %for.cond2
br label %for.cond17
for.cond17: ; preds = %for.inc23, %for.end15
%i16.0 = phi i32 [ 0, %for.end15 ], [ %inc24, %for.inc23 ]
%exitcond = icmp ne i32 %i16.0, 1024
br i1 %exitcond, label %for.body19, label %for.end25
for.body19: ; preds = %for.cond17
br label %S2
S2: ; preds = %for.body19
%add20 = add nsw i32 %i16.0, 1
%arrayidx21 = getelementptr inbounds i32, i32* %sum, i32 %add20
%tmp4 = load i32, i32* %arrayidx21, align 4
%mul = mul nsw i32 %tmp4, 3
%arrayidx22 = getelementptr inbounds i32, i32* %sum, i32 %i16.0
store i32 %mul, i32* %arrayidx22, align 4
br label %for.inc23
for.inc23: ; preds = %S2
%inc24 = add nsw i32 %i16.0, 1
br label %for.cond17
for.end25: ; preds = %for.cond17
ret void
}

Some files were not shown because too many files have changed in this diff Show More