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,216 +0,0 @@
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
; RUN: opt < %s -alignment-from-assumptions -S | FileCheck %s
; RUN: opt < %s -passes=alignment-from-assumptions -S | FileCheck %s
define i32 @foo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%0 = load i32, i32* %a, align 4
ret i32 %0
; CHECK-LABEL: @foo
; CHECK: load i32, i32* {{[^,]+}}, align 32
; CHECK: ret i32
}
define i32 @foo2(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%offsetptr = add i64 %ptrint, 24
%maskedptr = and i64 %offsetptr, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%arrayidx = getelementptr inbounds i32, i32* %a, i64 2
%0 = load i32, i32* %arrayidx, align 4
ret i32 %0
; CHECK-LABEL: @foo2
; CHECK: load i32, i32* {{[^,]+}}, align 16
; CHECK: ret i32
}
define i32 @foo2a(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%offsetptr = add i64 %ptrint, 28
%maskedptr = and i64 %offsetptr, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%arrayidx = getelementptr inbounds i32, i32* %a, i64 -1
%0 = load i32, i32* %arrayidx, align 4
ret i32 %0
; CHECK-LABEL: @foo2a
; CHECK: load i32, i32* {{[^,]+}}, align 32
; CHECK: ret i32
}
define i32 @goo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%0 = load i32, i32* %a, align 4
ret i32 %0
; CHECK-LABEL: @goo
; CHECK: load i32, i32* {{[^,]+}}, align 32
; CHECK: ret i32
}
define i32 @hoo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%r.06 = phi i32 [ 0, %entry ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
%0 = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %0, %r.06
%indvars.iv.next = add i64 %indvars.iv, 8
%1 = trunc i64 %indvars.iv.next to i32
%cmp = icmp slt i32 %1, 2048
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
%add.lcssa = phi i32 [ %add, %for.body ]
ret i32 %add.lcssa
; CHECK-LABEL: @hoo
; CHECK: load i32, i32* %arrayidx, align 32
; CHECK: ret i32 %add.lcssa
}
define i32 @joo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 4, %entry ], [ %indvars.iv.next, %for.body ]
%r.06 = phi i32 [ 0, %entry ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
%0 = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %0, %r.06
%indvars.iv.next = add i64 %indvars.iv, 8
%1 = trunc i64 %indvars.iv.next to i32
%cmp = icmp slt i32 %1, 2048
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
%add.lcssa = phi i32 [ %add, %for.body ]
ret i32 %add.lcssa
; CHECK-LABEL: @joo
; CHECK: load i32, i32* %arrayidx, align 16
; CHECK: ret i32 %add.lcssa
}
define i32 @koo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%r.06 = phi i32 [ 0, %entry ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
%0 = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %0, %r.06
%indvars.iv.next = add i64 %indvars.iv, 4
%1 = trunc i64 %indvars.iv.next to i32
%cmp = icmp slt i32 %1, 2048
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
%add.lcssa = phi i32 [ %add, %for.body ]
ret i32 %add.lcssa
; CHECK-LABEL: @koo
; CHECK: load i32, i32* %arrayidx, align 16
; CHECK: ret i32 %add.lcssa
}
define i32 @koo2(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ -4, %entry ], [ %indvars.iv.next, %for.body ]
%r.06 = phi i32 [ 0, %entry ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
%0 = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %0, %r.06
%indvars.iv.next = add i64 %indvars.iv, 4
%1 = trunc i64 %indvars.iv.next to i32
%cmp = icmp slt i32 %1, 2048
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
%add.lcssa = phi i32 [ %add, %for.body ]
ret i32 %add.lcssa
; CHECK-LABEL: @koo2
; CHECK: load i32, i32* %arrayidx, align 16
; CHECK: ret i32 %add.lcssa
}
define i32 @moo(i32* nocapture %a) nounwind uwtable {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%0 = bitcast i32* %a to i8*
tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 64, i32 4, i1 false)
ret i32 undef
; CHECK-LABEL: @moo
; CHECK: @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 64, i32 32, i1 false)
; CHECK: ret i32 undef
}
define i32 @moo2(i32* nocapture %a, i32* nocapture %b) nounwind uwtable {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%ptrint1 = ptrtoint i32* %b to i64
%maskedptr3 = and i64 %ptrint1, 127
%maskcond4 = icmp eq i64 %maskedptr3, 0
tail call void @llvm.assume(i1 %maskcond4)
%0 = bitcast i32* %a to i8*
%1 = bitcast i32* %b to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 64, i32 4, i1 false)
ret i32 undef
; CHECK-LABEL: @moo2
; CHECK: @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 64, i32 32, i1 false)
; CHECK: ret i32 undef
}
declare void @llvm.assume(i1) nounwind
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind

View File

@ -1,216 +0,0 @@
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
; RUN: opt < %s -alignment-from-assumptions -S | FileCheck %s
; RUN: opt < %s -passes=alignment-from-assumptions -S | FileCheck %s
define i32 @foo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%0 = load i32, i32* %a, align 4
ret i32 %0
; CHECK-LABEL: @foo
; CHECK: load i32, i32* {{[^,]+}}, align 32
; CHECK: ret i32
}
define i32 @foo2(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%offsetptr = add i64 %ptrint, 24
%maskedptr = and i64 %offsetptr, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%arrayidx = getelementptr inbounds i32, i32* %a, i64 2
%0 = load i32, i32* %arrayidx, align 4
ret i32 %0
; CHECK-LABEL: @foo2
; CHECK: load i32, i32* {{[^,]+}}, align 16
; CHECK: ret i32
}
define i32 @foo2a(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%offsetptr = add i64 %ptrint, 28
%maskedptr = and i64 %offsetptr, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%arrayidx = getelementptr inbounds i32, i32* %a, i64 -1
%0 = load i32, i32* %arrayidx, align 4
ret i32 %0
; CHECK-LABEL: @foo2a
; CHECK: load i32, i32* {{[^,]+}}, align 32
; CHECK: ret i32
}
define i32 @goo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%0 = load i32, i32* %a, align 4
ret i32 %0
; CHECK-LABEL: @goo
; CHECK: load i32, i32* {{[^,]+}}, align 32
; CHECK: ret i32
}
define i32 @hoo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%r.06 = phi i32 [ 0, %entry ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
%0 = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %0, %r.06
%indvars.iv.next = add i64 %indvars.iv, 8
%1 = trunc i64 %indvars.iv.next to i32
%cmp = icmp slt i32 %1, 2048
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
%add.lcssa = phi i32 [ %add, %for.body ]
ret i32 %add.lcssa
; CHECK-LABEL: @hoo
; CHECK: load i32, i32* %arrayidx, align 32
; CHECK: ret i32 %add.lcssa
}
define i32 @joo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 4, %entry ], [ %indvars.iv.next, %for.body ]
%r.06 = phi i32 [ 0, %entry ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
%0 = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %0, %r.06
%indvars.iv.next = add i64 %indvars.iv, 8
%1 = trunc i64 %indvars.iv.next to i32
%cmp = icmp slt i32 %1, 2048
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
%add.lcssa = phi i32 [ %add, %for.body ]
ret i32 %add.lcssa
; CHECK-LABEL: @joo
; CHECK: load i32, i32* %arrayidx, align 16
; CHECK: ret i32 %add.lcssa
}
define i32 @koo(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%r.06 = phi i32 [ 0, %entry ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
%0 = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %0, %r.06
%indvars.iv.next = add i64 %indvars.iv, 4
%1 = trunc i64 %indvars.iv.next to i32
%cmp = icmp slt i32 %1, 2048
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
%add.lcssa = phi i32 [ %add, %for.body ]
ret i32 %add.lcssa
; CHECK-LABEL: @koo
; CHECK: load i32, i32* %arrayidx, align 16
; CHECK: ret i32 %add.lcssa
}
define i32 @koo2(i32* nocapture %a) nounwind uwtable readonly {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ -4, %entry ], [ %indvars.iv.next, %for.body ]
%r.06 = phi i32 [ 0, %entry ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
%0 = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %0, %r.06
%indvars.iv.next = add i64 %indvars.iv, 4
%1 = trunc i64 %indvars.iv.next to i32
%cmp = icmp slt i32 %1, 2048
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
%add.lcssa = phi i32 [ %add, %for.body ]
ret i32 %add.lcssa
; CHECK-LABEL: @koo2
; CHECK: load i32, i32* %arrayidx, align 16
; CHECK: ret i32 %add.lcssa
}
define i32 @moo(i32* nocapture %a) nounwind uwtable {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%0 = bitcast i32* %a to i8*
tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 64, i32 4, i1 false)
ret i32 undef
; CHECK-LABEL: @moo
; CHECK: @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 64, i32 32, i1 false)
; CHECK: ret i32 undef
}
define i32 @moo2(i32* nocapture %a, i32* nocapture %b) nounwind uwtable {
entry:
%ptrint = ptrtoint i32* %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
%ptrint1 = ptrtoint i32* %b to i64
%maskedptr3 = and i64 %ptrint1, 127
%maskcond4 = icmp eq i64 %maskedptr3, 0
tail call void @llvm.assume(i1 %maskcond4)
%0 = bitcast i32* %a to i8*
%1 = bitcast i32* %b to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 64, i32 4, i1 false)
ret i32 undef
; CHECK-LABEL: @moo2
; CHECK: @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 64, i32 32, i1 false)
; CHECK: ret i32 undef
}
declare void @llvm.assume(i1) nounwind
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind

View File

@ -1,155 +0,0 @@
; RUN: opt -alignment-from-assumptions -S < %s | FileCheck %s
; RUN: opt -passes=alignment-from-assumptions -S < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%type1 = type { %type2 }
%type2 = type { [4 x i8] }
; Function Attrs: nounwind
declare void @llvm.assume(i1) #0
; Function Attrs: nounwind readnone
declare i32 @llvm.bswap.i32(i32) #1
; Function Attrs: nounwind uwtable
define void @test1() unnamed_addr #2 align 2 {
; CHECK-LABEL: @test1
entry:
br i1 undef, label %if.then, label %if.end
if.then: ; preds = %entry
unreachable
if.end: ; preds = %entry
br i1 undef, label %return, label %if.end8
if.end8: ; preds = %if.end
br i1 undef, label %if.then13, label %if.end14
if.then13: ; preds = %if.end8
unreachable
if.end14: ; preds = %if.end8
br i1 undef, label %cond.false.i129, label %cond.end.i136
cond.false.i129: ; preds = %if.end14
unreachable
cond.end.i136: ; preds = %if.end14
br i1 undef, label %land.lhs.true.i, label %if.end.i145
land.lhs.true.i: ; preds = %cond.end.i136
br i1 undef, label %if.end.i145, label %if.then.i137
if.then.i137: ; preds = %land.lhs.true.i
br i1 undef, label %cond.false8.i, label %cond.end9.i
cond.false8.i: ; preds = %if.then.i137
unreachable
cond.end9.i: ; preds = %if.then.i137
br i1 undef, label %if.then23, label %if.end24
if.end.i145: ; preds = %land.lhs.true.i, %cond.end.i136
unreachable
if.then23: ; preds = %cond.end9.i
unreachable
if.end24: ; preds = %cond.end9.i
br i1 undef, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %if.end24
unreachable
for.end: ; preds = %if.end24
br i1 undef, label %if.end123, label %if.then121
if.then121: ; preds = %for.end
unreachable
if.end123: ; preds = %for.end
br i1 undef, label %if.end150, label %if.then126
if.then126: ; preds = %if.end123
%ptrint.i.i185 = ptrtoint %type1* undef to i64
%maskedptr.i.i186 = and i64 %ptrint.i.i185, 1
%maskcond.i.i187 = icmp eq i64 %maskedptr.i.i186, 0
tail call void @llvm.assume(i1 %maskcond.i.i187) #0
%ret.0..sroa_cast.i.i188 = bitcast %type1* undef to i32*
%ret.0.copyload.i.i189 = load i32, i32* %ret.0..sroa_cast.i.i188, align 2
; CHECK: load {{.*}} align 2
%0 = tail call i32 @llvm.bswap.i32(i32 %ret.0.copyload.i.i189) #0
%conv131 = zext i32 %0 to i64
%add.ptr132 = getelementptr inbounds i8, i8* undef, i64 %conv131
%1 = bitcast i8* %add.ptr132 to %type1*
br i1 undef, label %if.end150, label %if.end.i173
if.end.i173: ; preds = %if.then126
br i1 undef, label %test1.exit, label %cond.false.i.i.i.i174
cond.false.i.i.i.i174: ; preds = %if.end.i173
unreachable
test1.exit: ; preds = %if.end.i173
br i1 undef, label %test1a.exit, label %if.end.i124
if.end.i124: ; preds = %test1.exit
unreachable
test1a.exit: ; preds = %test1.exit
br i1 undef, label %if.end150, label %for.body137.lr.ph
for.body137.lr.ph: ; preds = %test1a.exit
br label %for.body137
for.body137: ; preds = %test1b.exit, %for.body137.lr.ph
%ShndxTable.0309 = phi %type1* [ %1, %for.body137.lr.ph ], [ %incdec.ptr, %test1b.exit ]
%ret.0..sroa_cast.i.i106 = bitcast %type1* %ShndxTable.0309 to i32*
br i1 undef, label %for.body137.if.end146_crit_edge, label %if.then140
for.body137.if.end146_crit_edge: ; preds = %for.body137
%incdec.ptr = getelementptr inbounds %type1, %type1* %ShndxTable.0309, i64 1
br i1 undef, label %cond.false.i70, label %cond.end.i
if.then140: ; preds = %for.body137
%ret.0.copyload.i.i102 = load i32, i32* %ret.0..sroa_cast.i.i106, align 2
; CHECK: load {{.*}} align 2
unreachable
cond.false.i70: ; preds = %for.body137.if.end146_crit_edge
unreachable
cond.end.i: ; preds = %for.body137.if.end146_crit_edge
br i1 undef, label %test1b.exit, label %cond.false.i.i
cond.false.i.i: ; preds = %cond.end.i
unreachable
test1b.exit: ; preds = %cond.end.i
br i1 undef, label %if.end150, label %for.body137
if.end150: ; preds = %test1b.exit, %test1a.exit, %if.then126, %if.end123
br i1 undef, label %for.end176, label %for.body155.lr.ph
for.body155.lr.ph: ; preds = %if.end150
unreachable
for.end176: ; preds = %if.end150
unreachable
return: ; preds = %if.end
ret void
}
attributes #0 = { nounwind }
attributes #1 = { nounwind readnone }
attributes #2 = { nounwind uwtable }