Imported Upstream version 5.18.0.167

Former-commit-id: 289509151e0fee68a1b591a20c9f109c3c789d3a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-20 08:25:10 +00:00
parent e19d552987
commit b084638f15
28489 changed files with 184 additions and 3866856 deletions

View File

@ -1,47 +0,0 @@
; RUN: opt -basicaa -loop-versioning -S < %s | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
; Version this loop with overlap checks between a, c and b, c.
define void @f(i32* %a, i32* %b, i32* %c) {
entry:
br label %for.body
; CHECK: for.body.lver.check:
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK-NOT: icmp
; CHECK: br i1 %memcheck.conflict, label %for.body.ph.lver.orig, label %for.body.ph
; CHECK: for.body.ph.lver.orig:
; CHECK: for.body.lver.orig:
; CHECK: br i1 %exitcond.lver.orig, label %for.end, label %for.body.lver.orig
; CHECK: for.body.ph:
; CHECK: for.body:
; CHECK: br i1 %exitcond, label %for.end, label %for.body
; CHECK: for.end:
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
%arrayidxA = getelementptr inbounds i32, i32* %a, i64 %ind
%loadA = load i32, i32* %arrayidxA, align 4
%arrayidxB = getelementptr inbounds i32, i32* %b, i64 %ind
%loadB = load i32, i32* %arrayidxB, align 4
%mulC = mul i32 %loadA, %loadB
%arrayidxC = getelementptr inbounds i32, i32* %c, i64 %ind
store i32 %mulC, i32* %arrayidxC, align 4
%add = add nuw nsw i64 %ind, 1
%exitcond = icmp eq i64 %add, 20
br i1 %exitcond, label %for.end, label %for.body
for.end: ; preds = %for.body
ret void
}

View File

@ -1,38 +0,0 @@
; This test ensures loop versioning does not produce an invalid dominator tree
; if the exit block of the loop (bb0) dominates the runtime check block
; (bb1 will become the runtime check block).
; RUN: opt -loop-distribute -enable-loop-distribute -verify-dom-info -S -o - %s > %t
; RUN: opt -loop-simplify -loop-distribute -enable-loop-distribute -verify-dom-info -S -o - %s > %t
; RUN: FileCheck --check-prefix CHECK-VERSIONING -input-file %t %s
; RUN: opt -loop-versioning -verify-dom-info -S -o - %s > %t
; RUN: opt -loop-simplify -loop-versioning -verify-dom-info -S -o - %s > %t
; RUN: FileCheck --check-prefix CHECK-VERSIONING -input-file %t %s
@c1 = external global i16
define void @f(i16 %a) {
br label %bb0
bb0:
br label %bb1
bb1:
%tmp1 = load i16, i16* @c1
br label %bb2
bb2:
%tmp2 = phi i16 [ %tmp1, %bb1 ], [ %tmp3, %bb2 ]
%tmp4 = getelementptr inbounds [1 x i32], [1 x i32]* undef, i32 0, i32 4
store i32 1, i32* %tmp4
%tmp5 = getelementptr inbounds [1 x i32], [1 x i32]* undef, i32 0, i32 9
store i32 0, i32* %tmp5
%tmp3 = add i16 %tmp2, 1
store i16 %tmp2, i16* @c1
%tmp6 = icmp sle i16 %tmp3, 0
br i1 %tmp6, label %bb2, label %bb0
}
; Simple check to make sure loop versioning happened.
; CHECK-VERSIONING: bb2.lver.check:

View File

@ -1,62 +0,0 @@
; RUN: opt -loop-versioning -S < %s | FileCheck %s
; Make sure all PHIs are properly updated in the exit block. Based on
; PR28037.
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@x = external global [2 x [3 x [5 x i16]]]
; CHECK-LABEL: @phi_with_undef
define void @phi_with_undef() {
bb6.lr.ph: ; preds = %bb5.preheader
br label %bb6
bb6: ; preds = %bb6.lr.ph, %bb6
%_tmp1423 = phi i16 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ]
%_tmp123 = getelementptr [2 x [3 x [5 x i16]]], [2 x [3 x [5 x i16]]]* @x, i16 0, i64 undef
%_tmp125 = sext i16 %_tmp1423 to i64
%_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp125
%_tmp129 = getelementptr [5 x i16], [5 x i16]* %_tmp126, i16 0, i64 undef
%_tmp130 = load i16, i16* %_tmp129
store i16 undef, i16* getelementptr ([2 x [3 x [5 x i16]]], [2 x [3 x [5 x i16]]]* @x, i64 0, i64 undef, i64 undef, i64 undef)
%_tmp142 = add i16 %_tmp1423, 1
br i1 false, label %bb6, label %loop.exit
loop.exit: ; preds = %bb6
%_tmp142.lcssa = phi i16 [ %_tmp142, %bb6 ]
%split = phi i16 [ undef, %bb6 ]
; CHECK: %split = phi i16 [ undef, %bb6 ], [ undef, %bb6.lver.orig ]
br label %bb9
bb9: ; preds = %bb9.loopexit, %bb1
ret void
}
; CHECK-LABEL: @phi_with_non_loop_defined_value
define void @phi_with_non_loop_defined_value() {
bb6.lr.ph: ; preds = %bb5.preheader
%t = add i16 1, 1
br label %bb6
bb6: ; preds = %bb6.lr.ph, %bb6
%_tmp1423 = phi i16 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ]
%_tmp123 = getelementptr [2 x [3 x [5 x i16]]], [2 x [3 x [5 x i16]]]* @x, i16 0, i64 undef
%_tmp125 = sext i16 %_tmp1423 to i64
%_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp125
%_tmp129 = getelementptr [5 x i16], [5 x i16]* %_tmp126, i16 0, i64 undef
%_tmp130 = load i16, i16* %_tmp129
store i16 undef, i16* getelementptr ([2 x [3 x [5 x i16]]], [2 x [3 x [5 x i16]]]* @x, i64 0, i64 undef, i64 undef, i64 undef)
%_tmp142 = add i16 %_tmp1423, 1
br i1 false, label %bb6, label %loop.exit
loop.exit: ; preds = %bb6
%_tmp142.lcssa = phi i16 [ %_tmp142, %bb6 ]
%split = phi i16 [ %t, %bb6 ]
; CHECK: %split = phi i16 [ %t, %bb6 ], [ %t, %bb6.lver.orig ]
br label %bb9
bb9: ; preds = %bb9.loopexit, %bb1
ret void
}

View File

@ -1,35 +0,0 @@
; RUN: opt -basicaa -loop-versioning -S < %s | FileCheck %s
target triple = "x86_64-unknown-linux-gnu"
define void @fill(i8** %ls1.20, i8** %ls2.21, i8* %cse3.22) {
; CHECK: bb1.lver.check:
; CHECK: br i1 %memcheck.conflict, label %bb1.ph.lver.orig, label %bb1.ph
bb1.ph:
%ls1.20.promoted = load i8*, i8** %ls1.20
%ls2.21.promoted = load i8*, i8** %ls2.21
br label %bb1
bb1:
%_tmp302 = phi i8* [ %ls2.21.promoted, %bb1.ph ], [ %_tmp30, %bb1 ]
%_tmp281 = phi i8* [ %ls1.20.promoted, %bb1.ph ], [ %_tmp28, %bb1 ]
%_tmp14 = getelementptr i8, i8* %_tmp281, i16 -1
%_tmp15 = load i8, i8* %_tmp14
%add = add i8 %_tmp15, 1
store i8 %add, i8* %_tmp281
store i8 %add, i8* %_tmp302
%_tmp28 = getelementptr i8, i8* %_tmp281, i16 1
%_tmp30 = getelementptr i8, i8* %_tmp302, i16 1
br i1 false, label %bb1, label %bb3.loopexit
bb3.loopexit:
%_tmp30.lcssa = phi i8* [ %_tmp30, %bb1 ]
%_tmp15.lcssa = phi i8 [ %_tmp15, %bb1 ]
%_tmp28.lcssa = phi i8* [ %_tmp28, %bb1 ]
store i8* %_tmp28.lcssa, i8** %ls1.20
store i8 %_tmp15.lcssa, i8* %cse3.22
store i8* %_tmp30.lcssa, i8** %ls2.21
br label %bb3
bb3:
ret void
}

View File

@ -1,38 +0,0 @@
; RUN: opt -loop-versioning -S < %s | FileCheck %s
; Checks that when introducing check, we don't accidentally introduce non-dominating instructions
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
%Dual.212 = type { %Dual.213, %Partials.215 }
%Dual.213 = type { double, %Partials.214 }
%Partials.214 = type { [2 x double] }
%Partials.215 = type { [2 x %Dual.213] }
; Function Attrs: sspreq
define void @"julia_axpy!_65480"(%Dual.212*, %Dual.212* %other) {
top:
br label %if24
; CHECK-NOT: %bc = bitcast i64* %v2.sroa.0.0..sroa_cast
; CHECK: %bound0 = icmp ult i8* %[[x:[a-z0-9]+]], %[[y:[a-z0-9]+]]
; CHECK-NOT: %bound1 = icmp ult i8* %[[y]], %[[x]]
if24: ; preds = %if24, %top
%"#temp#1.sroa.3.02" = phi i64 [ undef, %top ], [ %2, %if24 ]
%"#temp#1.sroa.0.01" = phi i64 [ undef, %top ], [ %1, %if24 ]
%1 = add i64 %"#temp#1.sroa.0.01", 1
%2 = add i64 %"#temp#1.sroa.3.02", 1
; This pointer is loop invariant. LAA used to re-use it from memcheck, even though it didn't dominate.
%v2.sroa.0.0..sroa_cast = bitcast %Dual.212* %0 to i64*
%v2.sroa.0.0.copyload = load i64, i64* %v2.sroa.0.0..sroa_cast, align 1
%3 = add i64 %"#temp#1.sroa.0.01", -1
%4 = getelementptr inbounds %Dual.212, %Dual.212* %other, i64 0, i32 1, i32 0, i64 0, i32 1, i32 0, i64 0
%5 = bitcast double* %4 to i64*
store i64 undef, i64* %5, align 8
%notlhs27 = icmp eq i64 %2, undef
%notrhs28 = icmp eq i64 %1, undef
%6 = or i1 %notrhs28, %notlhs27
br i1 %6, label %L41.L335_crit_edge, label %if24
L41.L335_crit_edge: ; preds = %if24
ret void
}

View File

@ -1,107 +0,0 @@
; RUN: opt -basicaa -loop-distribute -enable-loop-distribute -loop-simplify -scoped-noalias \
; RUN: -loop-versioning -S < %s | FileCheck %s
; Test the metadata generated when versioning an already versioned loop. Here
; we invoke loop distribution to perform the first round of versioning. It
; adds memchecks for accesses that can alias across the distribution boundary.
; Then we further version the distributed loops to fully disambiguate accesses
; within each.
;
; So as an example, we add noalias between C and A during the versioning
; within loop distribution and then add noalias between C and D during the
; second explicit versioning step:
;
; for (i = 0; i < n; i++) {
; A[i + 1] = A[i] * B[i];
; -------------------------------
; C[i] = D[i] * E[i];
; }
; To see it easier what's going on, I expanded every noalias/scope metadata
; reference below in a comment. For a scope I use the format scope(domain),
; e.g. scope 17 in domain 15 is written as 17(15).
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
@B = common global i32* null, align 8
@A = common global i32* null, align 8
@C = common global i32* null, align 8
@D = common global i32* null, align 8
@E = common global i32* null, align 8
define void @f() {
entry:
%a = load i32*, i32** @A, align 8
%b = load i32*, i32** @B, align 8
%c = load i32*, i32** @C, align 8
%d = load i32*, i32** @D, align 8
%e = load i32*, i32** @E, align 8
br label %for.body
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
%arrayidxA = getelementptr inbounds i32, i32* %a, i64 %ind
; CHECK: %loadA.ldist1 = {{.*}} !noalias !25
; A noalias C: !25 -> { 17(15), 18(15), 19(15), 26(24) }
; ^^^^^^
%loadA = load i32, i32* %arrayidxA, align 4
%arrayidxB = getelementptr inbounds i32, i32* %b, i64 %ind
%loadB = load i32, i32* %arrayidxB, align 4
%mulA = mul i32 %loadB, %loadA
%add = add nuw nsw i64 %ind, 1
%arrayidxA_plus_4 = getelementptr inbounds i32, i32* %a, i64 %add
store i32 %mulA, i32* %arrayidxA_plus_4, align 4
; CHECK: for.body:
%arrayidxD = getelementptr inbounds i32, i32* %d, i64 %ind
; CHECK: %loadD = {{.*}} !alias.scope !31
; D's scope: !31 -> { 18(15), 32(33) }
; ^^^^^^
%loadD = load i32, i32* %arrayidxD, align 4
%arrayidxE = getelementptr inbounds i32, i32* %e, i64 %ind
; CHECK: %loadE = {{.*}} !alias.scope !34
; E's scope: !34 -> { 19(15), 35(33) }
; ^^^^^^
%loadE = load i32, i32* %arrayidxE, align 4
%mulC = mul i32 %loadD, %loadE
%arrayidxC = getelementptr inbounds i32, i32* %c, i64 %ind
; CHECK: store i32 %mulC, {{.*}} !alias.scope !36, !noalias !38
; C's scope: !36 -> { 17(15), 37(33) }
; ^^^^^^
; C noalias D and E: !38 -> { 21(15), 32(33), 35(33) }
; ^^^^^^ ^^^^^^
store i32 %mulC, i32* %arrayidxC, align 4
%exitcond = icmp eq i64 %add, 20
br i1 %exitcond, label %for.end, label %for.body
for.end: ; preds = %for.body
ret void
}
; Domain for the second loop versioning for the top loop after
; distribution.
; CHECK: !15 = distinct !{!15, !"LVerDomain"}
; CHECK: !17 = distinct !{!17, !15}
; CHECK: !25 = !{!17, !18, !19, !26}
; CHECK: !31 = !{!18, !32}
; CHECK: !32 = distinct !{!32, !33}
; Domain for the second loop versioning for the bottom loop after
; distribution.
; CHECK: !33 = distinct !{!33, !"LVerDomain"}
; CHECK: !34 = !{!19, !35}
; CHECK: !35 = distinct !{!35, !33}
; CHECK: !36 = !{!17, !37}
; CHECK: !38 = !{!21, !32, !35}

View File

@ -1,54 +0,0 @@
; RUN: opt -basicaa -loop-versioning -S < %s | FileCheck %s
; A very simple case. After versioning the %loadA and %loadB can't alias with
; the store.
;
; To see it easier what's going on, I expanded every noalias/scope metadata
; reference below in a comment. For a scope I use the format scope(domain),
; e.g. scope 17 in domain 15 is written as 17(15).
; CHECK-LABEL: @f(
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
define void @f(i32* %a, i32* %b, i32* %c) {
entry:
br label %for.body
; CHECK: for.body.lver.orig:
; CHECK: for.body:
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
%arrayidxA = getelementptr inbounds i32, i32* %a, i64 %ind
; CHECK: %loadA = {{.*}} !alias.scope !0
; A's scope: !0 -> { 1(2) }
%loadA = load i32, i32* %arrayidxA, align 4
%arrayidxB = getelementptr inbounds i32, i32* %b, i64 %ind
; CHECK: %loadB = {{.*}} !alias.scope !3
; B's scope: !3 -> { 4(2) }
%loadB = load i32, i32* %arrayidxB, align 4
%mulC = mul i32 %loadA, %loadB
%arrayidxC = getelementptr inbounds i32, i32* %c, i64 %ind
; CHECK: store {{.*}} !alias.scope !5, !noalias !7
; C noalias A and B: !7 -> { 1(2), 4(2) }
store i32 %mulC, i32* %arrayidxC, align 4
%add = add nuw nsw i64 %ind, 1
%exitcond = icmp eq i64 %add, 20
br i1 %exitcond, label %for.end, label %for.body
for.end: ; preds = %for.body
ret void
}
; CHECK: !0 = !{!1}
; CHECK: !1 = distinct !{!1, !2}
; CHECK: !2 = distinct !{!2, !"LVerDomain"}
; CHECK: !3 = !{!4}
; CHECK: !4 = distinct !{!4, !2}
; CHECK: !5 = !{!6}
; CHECK: !6 = distinct !{!6, !2}
; CHECK: !7 = !{!1, !4}