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,48 @@
; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck -match-full-lines %s
;
; Combine 3 partial accesses into one.
;
; for (int j = 0; j < n; j += 1) {
; A[0] = 42.0;
; A[0] = 42.0;
; A[0] = 42.0;
; }
;
define void @coalesce_3partials(i32 %n, double* noalias nonnull %A) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
store double 42.0, double* %A
store double 42.0, double* %A
store double 42.0, double* %A
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Overwrites removed: 0
; CHECK: Partial writes coalesced: 2
; CHECK: }
; CHECK: After accesses {
; CHECK-NEXT: Stmt_body
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[0] : n <= 2147483647 };
; CHECK-NEXT: }

View File

@@ -0,0 +1,32 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,32 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 < 8 }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : 8 <= i0 < 16 }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : 16 <= i0 }"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,56 @@
; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck -match-full-lines %s
;
; Combine four partial stores into two.
; The stores write to the same array, but never the same element.
;
; for (int j = 0; j < n; j += 1) {
; A[0] = 21.0;
; A[1] = 42.0;
; A[0] = 21.0;
; A[1] = 42.0;
; }
;
define void @coalesce_disjointelements(i32 %n, double* noalias nonnull %A) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
%A_0 = getelementptr inbounds double, double* %A, i32 0
%A_1 = getelementptr inbounds double, double* %A, i32 1
store double 21.0, double* %A_0
store double 42.0, double* %A_1
store double 21.0, double* %A_0
store double 42.0, double* %A_1
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Overwrites removed: 0
; CHECK: Partial writes coalesced: 2
; CHECK: }
; CHECK: After accesses {
; CHECK-NEXT: Stmt_body
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[0] : n <= 2147483647 };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[1] };
; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[1] : n <= 2147483647 };
; CHECK-NEXT: }

View File

@@ -0,0 +1,36 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[1] }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[1] }"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,36 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 > 16 }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[1] : i0 > 16 }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 <= 16 }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[1] : i0 <= 16 }"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,46 @@
; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck -match-full-lines %s
;
; Combine two partial stores (with overlapping domains) into one.
;
; for (int j = 0; j < n; j += 1) {
; A[0] = 42.0;
; A[0] = 42.0;
; }
;
define void @coalesce_overlapping(i32 %n, double* noalias nonnull %A) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
store double 42.0, double* %A
store double 42.0, double* %A
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Overwrites removed: 0
; CHECK: Partial writes coalesced: 1
; CHECK: }
; CHECK: After accesses {
; CHECK-NEXT: Stmt_body
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[0] : n <= 2147483647 };
; CHECK-NEXT: }

View File

@@ -0,0 +1,28 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,28 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 < 18 }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 >= 8}"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,46 @@
; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck -match-full-lines %s
;
; Combine two partial stores (with disjoint domains) into one.
;
; for (int j = 0; j < n; j += 1) {
; A[0] = 42.0;
; A[0] = 42.0;
; }
;
define void @coalesce_partial(i32 %n, double* noalias nonnull %A) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
store double 42.0, double* %A
store double 42.0, double* %A
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Overwrites removed: 0
; CHECK: Partial writes coalesced: 1
; CHECK: }
; CHECK: After accesses {
; CHECK-NEXT: Stmt_body
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[0] : n <= 2147483647 };
; CHECK-NEXT: }

View File

@@ -0,0 +1,28 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,28 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 < 16 }"
},
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 >= 16 }"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,46 @@
; RUN: opt %loadPolly -polly-simplify -analyze < %s | FileCheck %s -match-full-lines
;
; Remove a dead load-instruction
; (an load whose result is not used anywhere)
;
; for (int j = 0; j < n; j += 1) {
; double val = A[0];
; A[0] = 42.0;
; }
;
define void @func(i32 %n, double* noalias nonnull %A) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
%val = load double, double* %A
store double 42.0, double* %A
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Dead accesses removed: 1
; CHECK: Dead instructions removed: 1
; CHECK: }
; CHECK: After accesses {
; CHECK-NEXT: Stmt_body
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
; CHECK-NEXT: }

View File

@@ -0,0 +1,53 @@
; RUN: opt %loadPolly -polly-simplify -analyze < %s | FileCheck %s -match-full-lines
;
; Remove a dead PHI write/read pair
; (accesses that are effectively not used)
;
; for (int j = 0; j < n; j += 1) {
; body:
; double phi = 42;
;
; body_succ:
; A[0] = 42.0;
; }
;
define void @func(i32 %n, double* noalias nonnull %A) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
br label %body_succ
body_succ:
%phi = phi double [42.0, %body]
store double 42.0, double* %A
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Dead accesses removed: 2
; CHECK: Dead instructions removed: 1
; CHECK: Stmts removed: 1
; CHECK: }
; CHECK: After accesses {
; CHECK-NEXT: Stmt_body_succ
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body_succ[i0] -> MemRef_A[0] };
; CHECK-NEXT: }

View File

@@ -0,0 +1,55 @@
; RUN: opt %loadPolly -polly-simplify -analyze < %s | FileCheck %s -match-full-lines
;
; Remove a dead value write/read pair
; (accesses that are effectively not used)
;
; for (int j = 0; j < n; j += 1) {
; body:
; double val = 12.5 + 12.5;
;
; body_succ:
; double unused = val + 21.0;
; A[0] = 42.0;
; }
;
define void @func(i32 %n, double* noalias nonnull %A) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
%val = fadd double 12.5, 12.5
br label %body_succ
body_succ:
%unused = fadd double %val, 21.0
store double 42.0, double* %A
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Dead accesses removed: 2
; CHECK: Dead instructions removed: 2
; CHECK: Stmts removed: 1
; CHECK: }
; CHECK: After accesses {
; CHECK-NEXT: Stmt_body_succ
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body_succ[i0] -> MemRef_A[0] };
; CHECK-NEXT: }

View File

@@ -0,0 +1,39 @@
; RUN: opt %loadPolly -polly-simplify -analyze < %s | FileCheck %s -match-full-lines
;
; Remove a dead instruction
; (an instruction whose result is not used anywhere)
;
; for (int j = 0; j < n; j += 1) {
; double val = 21.0 + 21.0;
; A[0] = 42.0;
; }
;
define void @func(i32 %n, double* noalias nonnull %A) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
%val = fadd double 21.0, 21.0
store double 42.0, double* %A
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Dead instructions removed: 1
; CHECK: }

View File

@@ -0,0 +1,38 @@
; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck %s -match-full-lines
;
; for (int j = 0; j < n; j += 1) {
; A[0] = 42.0;
; }
;
define void @emptyaccessdomain(i32 %n, double* noalias nonnull %A) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
store double 42.0, double* %A
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Accesses with empty domains removed: 1
; CHECK: Stmts removed: 1
; CHECK: }
; CHECK: After accesses {
; CHECK-NEXT: }

View File

@@ -0,0 +1,24 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] }"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,24 @@
{
"arrays" : [
{
"name" : "MemRef_A",
"sizes" : [ "*" ],
"type" : "double"
}
],
"context" : "[n] -> { : -2147483648 <= n <= 2147483647 }",
"name" : "%for---%return",
"statements" : [
{
"accesses" : [
{
"kind" : "write",
"relation" : "[n] -> { Stmt_body[i0] -> MemRef_A[0] : 1 = 0 }"
}
],
"domain" : "[n] -> { Stmt_body[i0] : 0 <= i0 < n }",
"name" : "Stmt_body",
"schedule" : "[n] -> { Stmt_body[i0] -> [i0] }"
}
]
}

View File

@@ -0,0 +1,37 @@
; RUN: opt %loadPolly -polly-scops -polly-simplify -analyze < %s | FileCheck %s
;
; The use of %sum.next by %phi counts as an escaping use.
; Don't remove the scalar write of %sum.next.
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define float @foo(float* %A) {
entry:
br label %header
header:
fence seq_cst
br i1 true, label %body, label %exit
body:
%i = phi i64 [ 0, %header ], [ %next, %body ]
%sum = phi float [ 0.0, %header ], [ %sum.next, %body ]
%arrayidx = getelementptr float, float* %A, i64 %i
%next = add nuw nsw i64 %i, 1
%val = load float, float* %arrayidx
%sum.next = fadd float %sum, %val
%cond = icmp ne i64 %i, 100
br i1 %cond, label %body, label %after
after:
br label %exit
exit:
%phi = phi float [%sum.next, %after], [0.0, %header]
ret float %phi
}
; CHECK: Statistics {
; CHECK: Dead accesses removed: 0
; CHECK: }

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