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,35 @@
; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
;
; CHECK: Valid Region for Scop:
;
; void jd(int *A, int *B, int c) {
; for (int i = 0; i < 1024; i++)
; A[i] = B[c];
; }
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @jd(i32* %A, i32* %B, i32 %c) {
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, 1024
br i1 %exitcond, label %for.body, label %for.end
for.body: ; preds = %for.cond
%idxprom = sext i32 %c to i64
%arrayidx = getelementptr inbounds i32, i32* %B, i64 %idxprom
%tmp = load i32, i32* %arrayidx, align 4
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
store i32 %tmp, i32* %arrayidx2, align 4
br label %for.inc
for.inc: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,39 @@
; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
;
; CHECK: Valid Region for Scop:
;
; void jd(int *A, int *B, int c) {
; for (int i = 0; i < 1024; i++)
; A[i] = B[c - 10] + B[5];
; }
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @jd(i32* %A, i32* %B, i32 %c) {
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, 1024
br i1 %exitcond, label %for.body, label %for.end
for.body: ; preds = %for.cond
%sub = add nsw i32 %c, -10
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds i32, i32* %B, i64 %idxprom
%tmp = load i32, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32, i32* %B, i64 5
%tmp1 = load i32, i32* %arrayidx1, align 4
%add = add nsw i32 %tmp, %tmp1
%arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
store i32 %add, i32* %arrayidx3, align 4
br label %for.inc
for.inc: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,33 @@
; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
;
; CHECK: Valid Region for Scop:
;
; void jd(int *A, int *B) {
; for (int i = 0; i < 1024; i++)
; A[i] = B[0];
; }
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @jd(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, 1024
br i1 %exitcond, label %for.body, label %for.end
for.body: ; preds = %for.cond
%tmp = load i32, i32* %B, align 4
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
store i32 %tmp, i32* %arrayidx2, align 4
br label %for.inc
for.inc: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,36 @@
; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
;
; CHECK: Valid Region for Scop:
;
; void jd(int *A, int *B) {
; for (int i = 0; i < 1024; i++)
; A[i] = B[0] + B[1023];
; }
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @jd(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, 1024
br i1 %exitcond, label %for.body, label %for.end
for.body: ; preds = %for.cond
%tmp = load i32, i32* %B, align 4
%arrayidx1 = getelementptr inbounds i32, i32* %B, i64 1023
%tmp1 = load i32, i32* %arrayidx1, align 4
%add = add nsw i32 %tmp, %tmp1
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
store i32 %add, i32* %arrayidx2, align 4
br label %for.inc
for.inc: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,296 @@
; RUN: opt %loadPolly -disable-basicaa -polly-detect -polly-invariant-load-hoisting=true -analyze < %s | FileCheck %s
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"
define void @base_pointer_in_condition(i64** noalias %A_ptr, i64 %N) nounwind {
entry:
fence seq_cst
br label %pre
pre:
%A = load i64*, i64** %A_ptr
br i1 true, label %for.i, label %then
for.i:
%indvar = phi i64 [ 0, %pre ], [ %indvar.next, %for.i ]
%scevgep = getelementptr i64, i64* %A, i64 %indvar
store i64 %indvar, i64* %scevgep
%indvar.next = add nsw i64 %indvar, 1
%exitcond = icmp eq i64 %indvar.next, %N
br i1 %exitcond, label %then, label %for.i
then:
br label %return
return:
fence seq_cst
ret void
}
; CHECK-LABEL: base_pointer_in_condition
; CHECK: Valid Region for Scop: pre => return
define void @base_pointer_is_argument(float* %A, i64 %n) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
br label %S1
S1:
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* %A, i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK-LABEL: base_pointer_is_argument
; CHECK: Valid Region for Scop: for.i => exit
define void @base_pointer_is_const_expr(i64 %n) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
br label %S1
S1:
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* inttoptr (i64 100 to float*), i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK-LABEL: base_pointer_is_const_expr
; CHECK-LABEL: Valid Region for Scop: for.i => exit
@A = external global float
define void @base_pointer_is_global(i64 %n) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
br label %S1
S1:
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* @A, i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK-LABEL: base_pointer_is_global
; CHECK: Valid Region for Scop: for.i => exit
declare float *@foo()
define void @base_pointer_is_inst_outside(i64 %n) {
entry:
%A = call float *@foo()
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
br label %S1
S1:
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* %A, i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK-LABEL: base_pointer_is_inst_outside
; CHECK: Valid Region for Scop: for.i => exit
declare float* @getNextBasePtr(float*) readnone nounwind
define void @base_pointer_is_phi_node(i64 %n, float* %A) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
%ptr = phi float* [ %ptr.next, %for.i.inc ], [ %A, %entry ]
; To get a PHI node inside a SCoP that can not be analyzed but
; for which the surrounding SCoP is normally still valid we use a function
; without any side effects.
%ptr.next = call float* @getNextBasePtr(float* %ptr)
br label %S1
S1:
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* %ptr, i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK-LABEL: base_pointer_is_phi_node
; CHECK-NOT: Valid Region for Scop
define void @base_pointer_is_inst_inside_invariant_1(i64 %n, float* %A) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
; A function return value, even with readnone nounwind attributes, is not
; considered a valid base pointer because it can return a pointer that aliases
; with something else (e.g. %A or a global) or return a different pointer at
; every call (e.g. malloc)
%ptr = call float* @getNextBasePtr(float* %A)
br label %S1
S1:
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* %ptr, i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK-LABEL: base_pointer_is_inst_inside_invariant_1
; CHECK-NOT: Valid Region for Scop
declare float* @getNextBasePtr2(float*) readnone nounwind
define void @base_pointer_is_inst_inside_invariant_2(i64 %n, float* %A) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
%ptr = call float* @getNextBasePtr2(float* %A)
%ptr2 = call float* @getNextBasePtr(float* %ptr)
br label %S1
S1:
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* %ptr2, i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK-LABEL: base_pointer_is_inst_inside_invariant_2
; CHECK-NOT: Valid Region for Scop
declare float* @getNextBasePtr3(float*, i64) readnone nounwind
define void @base_pointer_is_inst_inside_variant(i64 %n, float* %A) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
%ptr = call float* @getNextBasePtr3(float* %A, i64 %indvar.i)
%ptr2 = call float* @getNextBasePtr(float* %ptr)
br label %S1
S1:
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* %ptr2, i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK: base_pointer_is_inst_inside_variant
; CHECK-NOT: Valid Region for Scop
define void @base_pointer_is_ptr2ptr(float** noalias %A, i64 %n) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
%arrayidx = getelementptr float*, float** %A, i64 %indvar.i
br label %for.j
for.j:
%indvar.j = phi i64 [ 0, %for.i ], [ %indvar.j.next, %for.j ]
%conv = sitofp i64 %indvar.i to float
%basepointer = load float*, float** %arrayidx, align 8
%arrayidx5 = getelementptr float, float* %basepointer, i64 %indvar.j
store float %conv, float* %arrayidx5, align 4
%indvar.j.next = add i64 %indvar.j, 1
%exitcond.j = icmp ne i64 %indvar.j.next, %n
br i1 %exitcond.j, label %for.j, label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK: base_pointer_is_ptr2ptr
; CHECK: Valid Region for Scop: for.j => for.i.inc

View File

@@ -0,0 +1,24 @@
{
"arrays" : [
{
"name" : "MemRef_ptr",
"sizes" : [ "*" ],
"type" : "float"
}
],
"context" : "[n] -> { : -9223372036854775808 <= n <= 9223372036854775807 }",
"name" : "%for.i---%exit",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_S1[i0] -> MemRef_ptr[i0+1] }"
}
],
"domain" : "[n] -> { Stmt_S1[i0] : 0 <= i0 < n }",
"name" : "Stmt_S1",
"schedule" : "[n] -> { Stmt_S1[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,29 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "float*"
},
{
"name" : "MemRef_ptr",
"sizes" : [ "*" ],
"type" : "float"
}
],
"context" : "[n] -> { : -9223372036854775808 <= n <= 9223372036854775807 }",
"name" : "%for.i---%exit",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_S1[i0] -> MemRef_ptr[i0+1] }"
}
],
"domain" : "[n] -> { Stmt_S1[i0] : 0 <= i0 < n }",
"name" : "Stmt_S1",
"schedule" : "[n] -> { Stmt_S1[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,42 @@
; RUN: opt %loadPolly -polly-ignore-aliasing -polly-invariant-load-hoisting=true -polly-scops -polly-import-jscop -polly-codegen -analyze < %s | FileCheck %s
;
; This violated an assertion in setNewAccessRelation that assumed base pointers
; to be load-hoisted. Without this assertion, it codegen would generate invalid
; code.
;
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"
define void @base_pointer_load_is_inst_inside_invariant_1(i64 %n, float** %A) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
br label %S1
S1:
%ptr = load float*, float** %A
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* %ptr, i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; Detected by -polly-detect with required load hoist.
; CHECK-NOT: Valid Region for Scop: for.i => exit
;
; Load hoist if %ptr by -polly-scops.
; CHECK: Invariant Accesses: {
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_S1[i0] -> MemRef_A[0] };
; CHECK-NEXT: Execution Context: [n] -> { : n > 0 }
; CHECK-NEXT: }

View File

@@ -0,0 +1,37 @@
; RUN: opt %loadPolly -disable-basicaa -polly-detect -polly-import-jscop -polly-codegen -analyze < %s | FileCheck %s
;
; Polly codegen used to generate invalid code (referring to %ptr from the
; original region) when regeneration of the access function is necessary.
; The SCoP is now rejected as a whole because %ptr is not considered a valid
; base pointer.
;
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"
declare float* @getNextBasePtr(float*) readnone nounwind
define void @base_pointer_is_inst_inside_invariant_1(i64 %n, float* %A) {
entry:
br label %for.i
for.i:
%indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
br label %S1
S1:
%ptr = call float* @getNextBasePtr(float* %A)
%conv = sitofp i64 %indvar.i to float
%arrayidx5 = getelementptr float, float* %ptr, i64 %indvar.i
store float %conv, float* %arrayidx5, align 4
br label %for.i.inc
for.i.inc:
%indvar.i.next = add i64 %indvar.i, 1
%exitcond.i = icmp ne i64 %indvar.i.next, %n
br i1 %exitcond.i, label %for.i, label %exit
exit:
ret void
}
; CHECK-NOT: Valid Region for Scop

View File

@@ -0,0 +1,48 @@
; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
; void f(long A[], long N) {
; long i;
; if (true)
; for (i = 0; i < N; ++i)
; A[i] = i;
; else
; for (j = 0; j < N; ++j)
; A[j] = j;
; }
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"
define void @f(i64* %A, i64 %N) nounwind {
entry:
fence seq_cst
br i1 true, label %next, label %next2
next2:
br i1 true, label %for.j, label %return
for.j:
%indvar2 = phi i64 [ 0, %next2], [ %indvar2.next2, %for.j]
%scevgep2 = getelementptr i64, i64* %A, i64 %indvar2
store i64 %indvar2, i64* %scevgep2
%indvar2.next2 = add nsw i64 %indvar2, 1
%exitcond2 = icmp eq i64 %indvar2.next2, %N
br i1 %exitcond2, label %return, label %for.j
next:
br i1 true, label %for.i, label %return
for.i:
%indvar = phi i64 [ 0, %next], [ %indvar.next, %for.i ]
%scevgep = getelementptr i64, i64* %A, i64 %indvar
store i64 %indvar, i64* %scevgep
%indvar.next = add nsw i64 %indvar, 1
%exitcond = icmp eq i64 %indvar.next, %N
br i1 %exitcond, label %return, label %for.i
return:
fence seq_cst
ret void
}
; CHECK: Valid Region for Scop: next => return
; CHECK: Valid Region for Scop: next2 => return

View File

@@ -0,0 +1,60 @@
; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
; void f(long A[], long N) {
; long i;
; if (true)
; for (i = 0; i < N; ++i)
; A[i] = i;
; else
; for (j = 0; j < N; ++j)
; A[j] = j;
; }
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"
declare i64 @foo()
define void @f(i64* %A, i64 %N) nounwind {
entry:
fence seq_cst
br i1 true, label %next, label %next2
next2:
br i1 true, label %for.j, label %return
for.j:
%indvar2 = phi i64 [ 0, %next2], [ %indvar2.next2, %for.j]
%scevgep2 = getelementptr i64, i64* %A, i64 %indvar2
store i64 %indvar2, i64* %scevgep2
%indvar2.next2 = add nsw i64 %indvar2, 1
%exitcond2 = icmp eq i64 %indvar2.next2, %N
br i1 %exitcond2, label %return, label %for.j
next:
br i1 true, label %for.i, label %return
for.i:
%indvar = phi i64 [ 0, %next], [ %indvar.next, %for.i ]
%scevgep = getelementptr i64, i64* %A, i64 %indvar
store i64 %indvar, i64* %scevgep
%i = call i64 @foo()
%indvar.next = add nsw i64 %indvar, 1
%exitcond = icmp eq i64 %indvar.next, %N
br i1 %exitcond, label %return, label %for.i
return:
br i1 true, label %return_a, label %return_b
return_a:
br label %return_join
return_b:
br label %return_join
return_join:
fence seq_cst
ret void
}
; CHECK-NOT: Valid Region for Scop: next => return
; CHECK: Valid Region for Scop: next2 => return

View File

@@ -0,0 +1,33 @@
; RUN: opt %loadPolly -polly-detect -disable-output < %s
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"
define void @f(i64* %A, i64 %N, i64 %M) nounwind {
entry:
fence seq_cst
br label %for.i
for.i:
%indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.i ]
%scevgep = getelementptr i64, i64* %A, i64 %indvar
store i64 %indvar, i64* %scevgep
%indvar.next = add nsw i64 %indvar, 1
%exitcond = icmp eq i64 %indvar.next, %N
br i1 %exitcond, label %next, label %for.i
next:
fence seq_cst
br label %for.j
for.j:
%indvar.j = phi i64 [ %indvar, %next ], [ %indvar.j.next, %for.j ]
%scevgep.j = getelementptr i64, i64* %A, i64 %indvar.j
store i64 %indvar.j, i64* %scevgep.j
fence seq_cst
%indvar.j.next = add nsw i64 %indvar.j, 1
%exitcond.j = icmp eq i64 %indvar.j.next, %M
br i1 %exitcond.j, label %return, label %for.j
return:
fence seq_cst
ret void
}

View File

@@ -0,0 +1,47 @@
; RUN: opt %loadPolly -polly-scops -dot-scops -analyze < %s
;
; Check that the ScopPrinter does not crash.
; ScopPrinter needs the ScopDetection pass, which should depend on
; ScalarEvolution transitively.
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @func(i32 %n, i32 %m, double* noalias nonnull %A) {
entry:
br label %outer.for
outer.for:
%j = phi i32 [0, %entry], [%j.inc, %outer.inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %inner.for, label %outer.exit
inner.for:
%i = phi i32 [1, %outer.for], [%i.inc, %inner.inc]
%b = phi double [0.0, %outer.for], [%a, %inner.inc]
%i.cmp = icmp slt i32 %i, %m
br i1 %i.cmp, label %body1, label %inner.exit
body1:
%A_idx = getelementptr inbounds double, double* %A, i32 %i
%a = load double, double* %A_idx
store double %a, double* %A_idx
br label %inner.inc
inner.inc:
%i.inc = add nuw nsw i32 %i, 1
br label %inner.for
inner.exit:
br label %outer.inc
outer.inc:
store double %b, double* %A
%j.inc = add nuw nsw i32 %j, 1
br label %outer.for
outer.exit:
br label %return
return:
ret void
}

View File

@@ -0,0 +1,62 @@
; RUN: opt %loadPolly -polly-detect -analyze < %s \
; RUN: | FileCheck %s
;
; CHECK-NOT: Valid Region for Scop:
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%struct.hoge = type { i32, i32, i32, i32 }
; Function Attrs: nounwind uwtable
define void @widget() #0 {
bb13:
%tmp1 = alloca %struct.hoge, align 4
br i1 undef, label %bb14, label %bb19
bb14: ; preds = %bb13
%tmp = load i32, i32* undef, align 4, !tbaa !1
call void @quux() #2
br i1 false, label %bb15, label %bb18
bb15: ; preds = %bb14
%tmp16 = getelementptr inbounds %struct.hoge, %struct.hoge* %tmp1, i64 0, i32 1
%tmp17 = getelementptr inbounds %struct.hoge, %struct.hoge* %tmp1, i64 0, i32 2
br label %bb19
bb18: ; preds = %bb14
br label %bb19
bb19: ; preds = %bb18, %bb15, %bb13
%tmp20 = phi i32 [ undef, %bb13 ], [ %tmp, %bb15 ], [ %tmp, %bb18 ]
unreachable
bb21: ; preds = %bb8
unreachable
bb22: ; preds = %bb8, %bb8, %bb8, %bb8
br label %bb23
bb23: ; preds = %bb22
unreachable
bb24: ; preds = %bb8, %bb8
unreachable
bb25: ; preds = %bb2
unreachable
}
declare void @quux() #1
attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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" }
attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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" }
attributes #2 = { nounwind }
!llvm.ident = !{!0}
!0 = !{!"clang version 3.8.0 (trunk 252700) (llvm/trunk 252705)"}
!1 = !{!2, !2, i64 0}
!2 = !{!"int", !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}

View File

@@ -0,0 +1,54 @@
; RUN: opt %loadPolly -polly-detect -analyze < %s \
; RUN: | FileCheck %s
;
; CHECK-NOT: Valid Region for Scop:
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 @hoge() #0 {
bb:
br label %bb1
bb1: ; preds = %bb
br i1 undef, label %bb2, label %bb7
bb2: ; preds = %bb1
%tmp = load i32, i32* undef, align 8, !tbaa !1
%tmp3 = tail call i32 @widget() #2
br i1 false, label %bb4, label %bb5
bb4: ; preds = %bb2
br label %bb8
bb5: ; preds = %bb2
%tmp6 = sub i32 %tmp, %tmp3
br label %bb8
bb7: ; preds = %bb1
br label %bb8
bb8: ; preds = %bb7, %bb5, %bb4
ret void
}
; Function Attrs: inlinehint nounwind readonly uwtable
declare i32 @widget() #1
attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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" }
attributes #1 = { inlinehint nounwind readonly uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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" }
attributes #2 = { nounwind readonly }
!llvm.ident = !{!0}
!0 = !{!"clang version 3.8.0 (trunk 252700) (llvm/trunk 252705)"}
!1 = !{!2, !7, i64 8}
!2 = !{!"cli_target_info", !3, i64 0, !6, i64 8, !4, i64 32}
!3 = !{!"long", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!"cli_exe_info", !7, i64 0, !8, i64 4, !3, i64 8, !9, i64 16}
!7 = !{!"int", !4, i64 0}
!8 = !{!"short", !4, i64 0}
!9 = !{!"any pointer", !4, i64 0}

View File

@@ -0,0 +1,36 @@
; RUN: opt %loadPolly -polly-detect -analyze < %s
; Verify that the scop detection does not crash on inputs with unreachable
; blocks. Earlier we crashed when detecting error blocks.
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 @foo() {
entry:
br label %while.cond
while.cond: ; preds = %for.end, %entry
br i1 false, label %for.end, label %while.end8
while.cond1: ; preds = %while.cond4
br i1 undef, label %while.body3, label %for.inc
while.body3: ; preds = %while.cond1
br label %while.cond4
while.cond4: ; preds = %while.cond4, %while.body3
br i1 undef, label %while.cond4, label %while.cond1
for.inc: ; preds = %while.cond1
%conv = zext i16 undef to i32
br label %for.end
for.end: ; preds = %for.inc, %while.cond
%conv.sink = phi i32 [ %conv, %for.inc ], [ 0, %while.cond ]
br label %while.cond
while.end8: ; preds = %while.cond
ret void
}

View File

@@ -0,0 +1,53 @@
; RUN: opt %loadPolly -polly-detect \
; RUN: -analyze < %s | FileCheck %s
;
; CHECK: Valid Region for Scop: if.end.1631 => for.cond.1647.outer
;
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define void @qtm_decompress() #0 {
entry:
br label %if.end.1631
if.end.1631: ; preds = %entry
br i1 false, label %for.cond.1647.preheader, label %if.then.1635
if.then.1635: ; preds = %if.end.1631
br label %for.cond.1647.preheader
for.cond.1647.preheader: ; preds = %if.then.1635, %if.end.1631
br label %for.cond.1647.outer
for.cond.1647.outer: ; preds = %do.end.1685, %for.cond.1647.preheader
%bits_needed.5.ph = phi i8 [ 8, %for.cond.1647.preheader ], [ undef, %do.end.1685 ]
br label %for.cond.1647
for.cond.1647: ; preds = %do.cond.1718, %for.cond.1647.outer
%bits_needed.5 = phi i8 [ 8, %do.cond.1718 ], [ %bits_needed.5.ph, %for.cond.1647.outer ]
br i1 undef, label %do.cond.1718, label %if.then.1659
if.then.1659: ; preds = %for.cond.1647
br i1 false, label %do.end.1685, label %cleanup.1785
do.end.1685: ; preds = %if.then.1659
br label %for.cond.1647.outer
do.cond.1718: ; preds = %for.cond.1647
br i1 false, label %land.lhs.true.1736, label %for.cond.1647
land.lhs.true.1736: ; preds = %do.cond.1718
br label %if.then.1742
if.then.1742: ; preds = %land.lhs.true.1736
unreachable
cleanup.1785: ; preds = %if.then.1659
ret void
}
attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.ident = !{!0}
!0 = !{!"clang version 3.8.0 (trunk 250010) (llvm/trunk 250018)"}

View File

@@ -0,0 +1,45 @@
; RUN: opt %loadPolly -polly-detect \
; RUN: -analyze < %s | FileCheck %s
; CHECK: Valid Region for Scop: if.end.1631 => for.cond.1647.outer
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @qtm_decompress() {
entry:
br label %while.cond.outer.outer
while.cond.outer.outer: ; preds = %entry
br label %if.end.1631
if.end.1631: ; preds = %do.end.1721, %while.cond.outer.outer
br i1 false, label %for.cond.1647.preheader, label %if.then.1635
if.then.1635: ; preds = %if.end.1631
br label %for.cond.1647.preheader
for.cond.1647.preheader: ; preds = %if.then.1635, %if.end.1631
br label %for.cond.1647.outer
for.cond.1647.outer: ; preds = %do.end.1685, %for.cond.1647.preheader
%bits_needed.5.ph = phi i8 [ 8, %for.cond.1647.preheader ], [ 0, %do.end.1685 ]
br label %for.cond.1647
for.cond.1647: ; preds = %do.cond.1718, %for.cond.1647.outer
br i1 undef, label %do.cond.1718, label %if.then.1659
if.then.1659: ; preds = %for.cond.1647
br i1 false, label %do.end.1685, label %if.then.1662
if.then.1662: ; preds = %if.then.1659
unreachable
do.end.1685: ; preds = %if.then.1659
br label %for.cond.1647.outer
do.cond.1718: ; preds = %for.cond.1647
br i1 false, label %do.end.1721, label %for.cond.1647
do.end.1721: ; preds = %do.cond.1718
br label %if.end.1631
}

View File

@@ -0,0 +1,124 @@
; RUN: opt %loadPolly -polly-scops -analyze -polly-ignore-func=f.*,g.* < %s | FileCheck %s
;
; Check that the flag `-polly-ignore-func` works with regexes.
;
; CHECK: Function: h
; CHECK-NEXT: Region: %for.cond---%for.end
;
; CHECK-NOT: Function:
;
; void f1(int* sum) {
; for (int i = 0; i <= 100; i++)
; sum += i * 3;
; }
; void f2(int* sum) {
; for (int i = 0; i <= 100; i++)
; sum += i * 3;
; }
; void g1(int* sum) {
; for (int i = 0; i <= 100; i++)
; sum += i * 3;
; }
; void h(int* sum) {
; for (int i = 0; i <= 100; i++)
; sum += i * 3;
; }
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
define void @f1(i32* %sum) {
entry:
br label %entry.split1
entry.split1: ; preds = %entry
br label %entry.split
entry.split: ; preds = %entry.split1
br label %for.cond
for.cond: ; preds = %for.cond, %entry.split
%i1.0 = phi i32 [ 0, %entry.split ], [ %inc, %for.cond ]
%sum.reload = load i32, i32* %sum
%mul = mul nsw i32 %i1.0, 3
%add = add nsw i32 %sum.reload, %mul
%inc = add nsw i32 %i1.0, 1
store i32 %add, i32* %sum
%cmp = icmp slt i32 %i1.0, 100
br i1 %cmp, label %for.cond, label %for.end
for.end: ; preds = %for.cond
ret void
}
define void @f2(i32* %sum) {
entry:
br label %entry.split1
entry.split1: ; preds = %entry
br label %entry.split
entry.split: ; preds = %entry.split1
br label %for.cond
for.cond: ; preds = %for.cond, %entry.split
%i1.0 = phi i32 [ 0, %entry.split ], [ %inc, %for.cond ]
%sum.reload = load i32, i32* %sum
%mul = mul nsw i32 %i1.0, 3
%add = add nsw i32 %sum.reload, %mul
%inc = add nsw i32 %i1.0, 1
store i32 %add, i32* %sum
%cmp = icmp slt i32 %i1.0, 100
br i1 %cmp, label %for.cond, label %for.end
for.end: ; preds = %for.cond
ret void
}
define void @g1(i32* %sum) {
entry:
br label %entry.split1
entry.split1: ; preds = %entry
br label %entry.split
entry.split: ; preds = %entry.split1
br label %for.cond
for.cond: ; preds = %for.cond, %entry.split
%i1.0 = phi i32 [ 0, %entry.split ], [ %inc, %for.cond ]
%sum.reload = load i32, i32* %sum
%mul = mul nsw i32 %i1.0, 3
%add = add nsw i32 %sum.reload, %mul
%inc = add nsw i32 %i1.0, 1
store i32 %add, i32* %sum
%cmp = icmp slt i32 %i1.0, 100
br i1 %cmp, label %for.cond, label %for.end
for.end: ; preds = %for.cond
ret void
}
define void @h(i32* %sum) {
entry:
br label %entry.split1
entry.split1: ; preds = %entry
br label %entry.split
entry.split: ; preds = %entry.split1
br label %for.cond
for.cond: ; preds = %for.cond, %entry.split
%i1.0 = phi i32 [ 0, %entry.split ], [ %inc, %for.cond ]
%sum.reload = load i32, i32* %sum
%mul = mul nsw i32 %i1.0, 3
%add = add nsw i32 %sum.reload, %mul
%inc = add nsw i32 %i1.0, 1
store i32 %add, i32* %sum
%cmp = icmp slt i32 %i1.0, 100
br i1 %cmp, label %for.cond, label %for.end
for.end: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,68 @@
; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s --check-prefix=AFFINE
; RUN: opt %loadPolly -polly-scops -polly-allow-nonaffine -analyze < %s | FileCheck %s --check-prefix=NONAFFINE
; The loop for.body => for.inc has an unpredictable iteration count could due to
; the undef start value that it is compared to. Therefore the array element
; %arrayidx101 that depends on that exit value cannot be affine.
; Derived from test-suite/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c
define void @encode_line(i8* nocapture readonly %input, i32 %octets, i64 %p) {
entry:
br i1 undef, label %for.body, label %for.end
for.body:
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %p, %entry ]
%octets.addr.02 = phi i32 [ undef, %for.inc ], [ %octets, %entry ]
br i1 false, label %for.inc, label %if.else
if.else:
%cond = icmp eq i32 %octets.addr.02, 2
br i1 %cond, label %if.then84, label %for.end
if.then84:
%0 = add nsw i64 %indvars.iv, 1
%arrayidx101 = getelementptr inbounds i8, i8* %input, i64 %0
store i8 42, i8* %arrayidx101, align 1
br label %for.end
for.inc:
%cmp = icmp sgt i32 %octets.addr.02, 3
%indvars.iv.next = add nsw i64 %indvars.iv, 3
br i1 %cmp, label %for.body, label %for.end
for.end:
ret void
}
; AFFINE: Region: %if.else---%for.end
; AFFINE: Statements {
; AFFINE-NEXT: Stmt_if_then84
; AFFINE-NEXT: Domain :=
; AFFINE-NEXT: [octets, p_1, p] -> { Stmt_if_then84[] : octets = 2 };
; AFFINE-NEXT: Schedule :=
; AFFINE-NEXT: [octets, p_1, p] -> { Stmt_if_then84[] -> [] };
; AFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; AFFINE-NEXT: [octets, p_1, p] -> { Stmt_if_then84[] -> MemRef_input[1 + p] };
; AFFINE-NEXT: }
; NONAFFINE: Region: %for.body---%for.end
; NONAFFINE: Statements {
; NONAFFINE-NEXT: Stmt_for_body
; NONAFFINE-NEXT: Domain :=
; NONAFFINE-NEXT: [octets] -> { Stmt_for_body[0] };
; NONAFFINE-NEXT: Schedule :=
; NONAFFINE-NEXT: [octets] -> { Stmt_for_body[i0] -> [0, 0] };
; NONAFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; NONAFFINE-NEXT: [octets] -> { Stmt_for_body[i0] -> MemRef_indvars_iv[] };
; NONAFFINE-NEXT: Stmt_if_then84
; NONAFFINE-NEXT: Domain :=
; NONAFFINE-NEXT: [octets] -> { Stmt_if_then84[] : octets = 2 };
; NONAFFINE-NEXT: Schedule :=
; NONAFFINE-NEXT: [octets] -> { Stmt_if_then84[] -> [1, 0] };
; NONAFFINE-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
; NONAFFINE-NEXT: [octets] -> { Stmt_if_then84[] -> MemRef_indvars_iv[] };
; NONAFFINE-NEXT: MayWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; NONAFFINE-NEXT: [octets] -> { Stmt_if_then84[] -> MemRef_input[o0] };
; NONAFFINE-NEXT: }

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