aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-12-01 14:51:49 -0800
committerStephen Hines <srhines@google.com>2014-12-02 16:08:10 -0800
commit37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch)
tree8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /test/Analysis
parentd2327b22152ced7bc46dc629fc908959e8a52d03 (diff)
downloadexternal_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip
external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz
external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/BasicAA/2008-04-15-Byval.ll2
-rw-r--r--test/Analysis/BasicAA/assume.ll23
-rw-r--r--test/Analysis/BasicAA/cs-cs.ll15
-rw-r--r--test/Analysis/BasicAA/gcsetest.ll4
-rw-r--r--test/Analysis/BasicAA/modref.ll34
-rw-r--r--test/Analysis/BasicAA/phi-aa.ll1
-rw-r--r--test/Analysis/BasicAA/zext.ll209
-rw-r--r--test/Analysis/CFLAliasAnalysis/arguments-globals.ll20
-rw-r--r--test/Analysis/CFLAliasAnalysis/arguments.ll15
-rw-r--r--test/Analysis/CFLAliasAnalysis/basic-interproc-ret.ll26
-rw-r--r--test/Analysis/CFLAliasAnalysis/basic-interproc.ll24
-rw-r--r--test/Analysis/CFLAliasAnalysis/const-expr-gep.ll21
-rw-r--r--test/Analysis/CFLAliasAnalysis/constant-over-index.ll30
-rw-r--r--test/Analysis/CFLAliasAnalysis/empty.ll12
-rw-r--r--test/Analysis/CFLAliasAnalysis/full-store-partial-alias.ll37
-rw-r--r--test/Analysis/CFLAliasAnalysis/gep-signed-arithmetic.ll17
-rw-r--r--test/Analysis/CFLAliasAnalysis/multilevel-combine.ll31
-rw-r--r--test/Analysis/CFLAliasAnalysis/multilevel.ll30
-rw-r--r--test/Analysis/CFLAliasAnalysis/must-and-partial.ll39
-rw-r--r--test/Analysis/CFLAliasAnalysis/phi-and-select.ll36
-rw-r--r--test/Analysis/CFLAliasAnalysis/simple.ll18
-rw-r--r--test/Analysis/CFLAliasAnalysis/va.ll29
-rw-r--r--test/Analysis/CostModel/ARM/cast.ll112
-rw-r--r--test/Analysis/CostModel/PowerPC/cmp-expanded.ll14
-rw-r--r--test/Analysis/CostModel/X86/cast.ll43
-rw-r--r--test/Analysis/CostModel/X86/cmp.ll11
-rw-r--r--test/Analysis/CostModel/X86/sitofp.ll45
-rw-r--r--test/Analysis/CostModel/X86/uitofp.ll12
-rw-r--r--test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll40
-rw-r--r--test/Analysis/GlobalsModRef/pr12351.ll4
-rw-r--r--test/Analysis/ScalarEvolution/load-with-range-metadata.ll37
-rw-r--r--test/Analysis/ScalarEvolution/nsw-offset-assume.ll83
-rw-r--r--test/Analysis/ScalarEvolution/nsw.ll23
-rw-r--r--test/Analysis/ScalarEvolution/sext-iv-1.ll9
-rw-r--r--test/Analysis/ScopedNoAliasAA/basic-domains.ll57
-rw-r--r--test/Analysis/ScopedNoAliasAA/basic.ll27
-rw-r--r--test/Analysis/ScopedNoAliasAA/basic2.ll41
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/dse.ll1
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll2
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/tbaa-path.ll2
40 files changed, 1146 insertions, 90 deletions
diff --git a/test/Analysis/BasicAA/2008-04-15-Byval.ll b/test/Analysis/BasicAA/2008-04-15-Byval.ll
index 428189a..2ea0314 100644
--- a/test/Analysis/BasicAA/2008-04-15-Byval.ll
+++ b/test/Analysis/BasicAA/2008-04-15-Byval.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -std-compile-opts -S | FileCheck %s
+; RUN: opt < %s -O3 -S | FileCheck %s
; ModuleID = 'small2.c'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin8"
diff --git a/test/Analysis/BasicAA/assume.ll b/test/Analysis/BasicAA/assume.ll
new file mode 100644
index 0000000..e163b5a
--- /dev/null
+++ b/test/Analysis/BasicAA/assume.ll
@@ -0,0 +1,23 @@
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
+
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) #0
+declare void @llvm.assume(i1) #0
+
+define void @test1(i8* %P, i8* %Q) nounwind ssp {
+ tail call void @llvm.assume(i1 true)
+ tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
+ ret void
+
+; CHECK-LABEL: Function: test1:
+
+; CHECK: MayAlias: i8* %P, i8* %Q
+; CHECK: NoModRef: Ptr: i8* %P <-> tail call void @llvm.assume(i1 true)
+; CHECK: NoModRef: Ptr: i8* %Q <-> tail call void @llvm.assume(i1 true)
+; CHECK: Both ModRef: Ptr: i8* %P <-> tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
+; CHECK: Both ModRef: Ptr: i8* %Q <-> tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
+; CHECK: NoModRef: tail call void @llvm.assume(i1 true) <-> tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
+; CHECK: NoModRef: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false) <-> tail call void @llvm.assume(i1 true)
+}
+
+attributes #0 = { nounwind }
diff --git a/test/Analysis/BasicAA/cs-cs.ll b/test/Analysis/BasicAA/cs-cs.ll
index 682e4b6..693634c 100644
--- a/test/Analysis/BasicAA/cs-cs.ll
+++ b/test/Analysis/BasicAA/cs-cs.ll
@@ -8,6 +8,8 @@ declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) 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
+declare void @a_readonly_func(i8 *) noinline nounwind readonly
+
define <8 x i16> @test1(i8* %p, <8 x i16> %y) {
entry:
%q = getelementptr i8* %p, i64 16
@@ -218,4 +220,17 @@ define void @test5(i8* %P, i8* %Q, i8* %R) nounwind ssp {
; CHECK: Both ModRef: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %R, i64 12, i32 1, i1 false) <-> tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
}
+define void @test6(i8* %P) nounwind ssp {
+ call void @llvm.memset.p0i8.i64(i8* %P, i8 -51, i64 32, i32 8, i1 false)
+ call void @a_readonly_func(i8* %P)
+ ret void
+
+; CHECK-LABEL: Function: test6:
+
+; CHECK: Just Mod: Ptr: i8* %P <-> call void @llvm.memset.p0i8.i64(i8* %P, i8 -51, i64 32, i32 8, i1 false)
+; CHECK: Just Ref: Ptr: i8* %P <-> call void @a_readonly_func(i8* %P)
+; CHECK: Just Mod: call void @llvm.memset.p0i8.i64(i8* %P, i8 -51, i64 32, i32 8, i1 false) <-> call void @a_readonly_func(i8* %P)
+; CHECK: Just Ref: call void @a_readonly_func(i8* %P) <-> call void @llvm.memset.p0i8.i64(i8* %P, i8 -51, i64 32, i32 8, i1 false)
+}
+
attributes #0 = { nounwind }
diff --git a/test/Analysis/BasicAA/gcsetest.ll b/test/Analysis/BasicAA/gcsetest.ll
index db557b7..64792eb 100644
--- a/test/Analysis/BasicAA/gcsetest.ll
+++ b/test/Analysis/BasicAA/gcsetest.ll
@@ -1,5 +1,5 @@
-; Test that GCSE uses basicaa to do alias analysis, which is capable of
-; disambiguating some obvious cases. All loads should be removable in
+; Test that GCSE uses basicaa to do alias analysis, which is capable of
+; disambiguating some obvious cases. All loads should be removable in
; this testcase.
; RUN: opt < %s -basicaa -gvn -instcombine -dce -S | FileCheck %s
diff --git a/test/Analysis/BasicAA/modref.ll b/test/Analysis/BasicAA/modref.ll
index 8421faf..0d8bf71 100644
--- a/test/Analysis/BasicAA/modref.ll
+++ b/test/Analysis/BasicAA/modref.ll
@@ -8,20 +8,20 @@ declare void @external(i32*)
define i32 @test0(i8* %P) {
%A = alloca i32
call void @external(i32* %A)
-
+
store i32 0, i32* %A
-
+
call void @llvm.memset.p0i8.i32(i8* %P, i8 0, i32 42, i32 1, i1 false)
-
+
%B = load i32* %A
ret i32 %B
-
-; CHECK: @test0
+
+; CHECK-LABEL: @test0
; CHECK: ret i32 0
}
define i8 @test1() {
-; CHECK: @test1
+; CHECK-LABEL: @test1
%A = alloca i8
%B = alloca i8
@@ -35,7 +35,7 @@ define i8 @test1() {
}
define i8 @test2(i8* %P) {
-; CHECK: @test2
+; CHECK-LABEL: @test2
%P2 = getelementptr i8* %P, i32 127
store i8 1, i8* %P2 ;; Not dead across memset
call void @llvm.memset.p0i8.i8(i8* %P, i8 2, i8 127, i32 0, i1 false)
@@ -45,12 +45,12 @@ define i8 @test2(i8* %P) {
}
define i8 @test2a(i8* %P) {
-; CHECK: @test2
+; CHECK-LABEL: @test2
%P2 = getelementptr i8* %P, i32 126
-
+
;; FIXME: DSE isn't zapping this dead store.
store i8 1, i8* %P2 ;; Dead, clobbered by memset.
-
+
call void @llvm.memset.p0i8.i8(i8* %P, i8 2, i8 127, i32 0, i1 false)
%A = load i8* %P2
ret i8 %A
@@ -59,11 +59,11 @@ define i8 @test2a(i8* %P) {
}
define void @test3(i8* %P, i8 %X) {
-; CHECK: @test3
+; CHECK-LABEL: @test3
; CHECK-NOT: store
; CHECK-NOT: %Y
%Y = add i8 %X, 1 ;; Dead, because the only use (the store) is dead.
-
+
%P2 = getelementptr i8* %P, i32 2
store i8 %Y, i8* %P2 ;; Not read by lifetime.end, should be removed.
; CHECK: store i8 2, i8* %P2
@@ -75,9 +75,9 @@ define void @test3(i8* %P, i8 %X) {
}
define void @test3a(i8* %P, i8 %X) {
-; CHECK: @test3a
+; CHECK-LABEL: @test3a
%Y = add i8 %X, 1 ;; Dead, because the only use (the store) is dead.
-
+
%P2 = getelementptr i8* %P, i32 2
store i8 %Y, i8* %P2
; CHECK-NEXT: call void @llvm.lifetime.end
@@ -95,7 +95,7 @@ define i32 @test4(i8* %P) {
%tmp2 = load i32* @G1
%sub = sub i32 %tmp2, %tmp
ret i32 %sub
-; CHECK: @test4
+; CHECK-LABEL: @test4
; CHECK-NOT: load
; CHECK: memset.p0i8.i32
; CHECK-NOT: load
@@ -123,7 +123,7 @@ define i8 @test6(i8* %p, i8* noalias %a) {
%y = load i8* %a
%z = add i8 %x, %y
ret i8 %z
-; CHECK: @test6
+; CHECK-LABEL: @test6
; CHECK: load i8* %a
; CHECK-NOT: load
; CHECK: ret
@@ -139,7 +139,7 @@ entry:
call void @test7decl(i32* %add.ptr)
%tmp = load i32* %x, align 4
ret i32 %tmp
-; CHECK: @test7(
+; CHECK-LABEL: @test7(
; CHECK: store i32 0
; CHECK: call void @test7decl
; CHECK: load i32*
diff --git a/test/Analysis/BasicAA/phi-aa.ll b/test/Analysis/BasicAA/phi-aa.ll
index 74279e1..c1100f1 100644
--- a/test/Analysis/BasicAA/phi-aa.ll
+++ b/test/Analysis/BasicAA/phi-aa.ll
@@ -39,6 +39,7 @@ return:
; CHECK-LABEL: pr18068
; CHECK: MayAlias: i32* %0, i32* %arrayidx5
+; CHECK: NoAlias: i32* %arrayidx13, i32* %arrayidx5
define i32 @pr18068(i32* %jj7, i32* %j) {
entry:
diff --git a/test/Analysis/BasicAA/zext.ll b/test/Analysis/BasicAA/zext.ll
new file mode 100644
index 0000000..b59d16c
--- /dev/null
+++ b/test/Analysis/BasicAA/zext.ll
@@ -0,0 +1,209 @@
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | 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-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK-LABEL: test_with_zext
+; CHECK: NoAlias: i8* %a, i8* %b
+
+define void @test_with_zext() {
+ %1 = tail call i8* @malloc(i64 120)
+ %a = getelementptr inbounds i8* %1, i64 8
+ %2 = getelementptr inbounds i8* %1, i64 16
+ %3 = zext i32 3 to i64
+ %b = getelementptr inbounds i8* %2, i64 %3
+ ret void
+}
+
+; CHECK-LABEL: test_with_lshr
+; CHECK: NoAlias: i8* %a, i8* %b
+
+define void @test_with_lshr(i64 %i) {
+ %1 = tail call i8* @malloc(i64 120)
+ %a = getelementptr inbounds i8* %1, i64 8
+ %2 = getelementptr inbounds i8* %1, i64 16
+ %3 = lshr i64 %i, 2
+ %b = getelementptr inbounds i8* %2, i64 %3
+ ret void
+}
+
+; CHECK-LABEL: test_with_a_loop
+; CHECK: NoAlias: i8* %a, i8* %b
+
+define void @test_with_a_loop(i8* %mem) {
+ br label %for.loop
+
+for.loop:
+ %i = phi i32 [ 0, %0 ], [ %i.plus1, %for.loop ]
+ %a = getelementptr inbounds i8* %mem, i64 8
+ %a.plus1 = getelementptr inbounds i8* %mem, i64 16
+ %i.64 = zext i32 %i to i64
+ %b = getelementptr inbounds i8* %a.plus1, i64 %i.64
+ %i.plus1 = add nuw nsw i32 %i, 1
+ %cmp = icmp eq i32 %i.plus1, 10
+ br i1 %cmp, label %for.loop.exit, label %for.loop
+
+for.loop.exit:
+ ret void
+}
+
+; CHECK-LABEL: test_with_varying_base_pointer_in_loop
+; CHECK: NoAlias: i8* %a, i8* %b
+
+define void @test_with_varying_base_pointer_in_loop(i8* %mem.orig) {
+ br label %for.loop
+
+for.loop:
+ %mem = phi i8* [ %mem.orig, %0 ], [ %mem.plus1, %for.loop ]
+ %i = phi i32 [ 0, %0 ], [ %i.plus1, %for.loop ]
+ %a = getelementptr inbounds i8* %mem, i64 8
+ %a.plus1 = getelementptr inbounds i8* %mem, i64 16
+ %i.64 = zext i32 %i to i64
+ %b = getelementptr inbounds i8* %a.plus1, i64 %i.64
+ %i.plus1 = add nuw nsw i32 %i, 1
+ %mem.plus1 = getelementptr inbounds i8* %mem, i64 8
+ %cmp = icmp eq i32 %i.plus1, 10
+ br i1 %cmp, label %for.loop.exit, label %for.loop
+
+for.loop.exit:
+ ret void
+}
+
+; CHECK-LABEL: test_sign_extension
+; CHECK: PartialAlias: i64* %b.i64, i8* %a
+
+define void @test_sign_extension(i32 %p) {
+ %1 = tail call i8* @malloc(i64 120)
+ %p.64 = zext i32 %p to i64
+ %a = getelementptr inbounds i8* %1, i64 %p.64
+ %p.minus1 = add i32 %p, -1
+ %p.minus1.64 = zext i32 %p.minus1 to i64
+ %b.i8 = getelementptr inbounds i8* %1, i64 %p.minus1.64
+ %b.i64 = bitcast i8* %b.i8 to i64*
+ ret void
+}
+
+; CHECK-LABEL: test_fe_tools
+; CHECK: PartialAlias: i32* %a, i32* %b
+
+define void @test_fe_tools([8 x i32]* %values) {
+ br label %reorder
+
+for.loop:
+ %i = phi i32 [ 0, %reorder ], [ %i.next, %for.loop ]
+ %idxprom = zext i32 %i to i64
+ %b = getelementptr inbounds [8 x i32]* %values, i64 0, i64 %idxprom
+ %i.next = add nuw nsw i32 %i, 1
+ %1 = icmp eq i32 %i.next, 10
+ br i1 %1, label %for.loop.exit, label %for.loop
+
+reorder:
+ %a = getelementptr inbounds [8 x i32]* %values, i64 0, i64 1
+ br label %for.loop
+
+for.loop.exit:
+ ret void
+}
+
+@b = global i32 0, align 4
+@d = global i32 0, align 4
+
+; CHECK-LABEL: test_spec2006
+; CHECK: PartialAlias: i32** %x, i32** %y
+
+define void @test_spec2006() {
+ %h = alloca [1 x [2 x i32*]], align 16
+ %d.val = load i32* @d, align 4
+ %d.promoted = sext i32 %d.val to i64
+ %1 = icmp slt i32 %d.val, 2
+ br i1 %1, label %.lr.ph, label %3
+
+.lr.ph: ; preds = %0
+ br label %2
+
+; <label>:2 ; preds = %.lr.ph, %2
+ %i = phi i32 [ %d.val, %.lr.ph ], [ %i.plus1, %2 ]
+ %i.promoted = sext i32 %i to i64
+ %x = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 %d.promoted, i64 %i.promoted
+ %i.plus1 = add nsw i32 %i, 1
+ %cmp = icmp slt i32 %i.plus1, 2
+ br i1 %cmp, label %2, label %3
+
+; <label>:3 ; preds = %._crit_edge, %0
+ %y = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 0, i64 1
+ ret void
+}
+
+; CHECK-LABEL: test_modulo_analysis_easy_case
+; CHECK: NoAlias: i32** %x, i32** %y
+
+define void @test_modulo_analysis_easy_case(i64 %i) {
+ %h = alloca [1 x [2 x i32*]], align 16
+ %x = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 %i, i64 0
+ %y = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 0, i64 1
+ ret void
+}
+
+; CHECK-LABEL: test_modulo_analysis_in_loop
+; CHECK: NoAlias: i32** %x, i32** %y
+
+define void @test_modulo_analysis_in_loop() {
+ %h = alloca [1 x [2 x i32*]], align 16
+ br label %for.loop
+
+for.loop:
+ %i = phi i32 [ 0, %0 ], [ %i.plus1, %for.loop ]
+ %i.promoted = sext i32 %i to i64
+ %x = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 %i.promoted, i64 0
+ %y = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 0, i64 1
+ %i.plus1 = add nsw i32 %i, 1
+ %cmp = icmp slt i32 %i.plus1, 2
+ br i1 %cmp, label %for.loop, label %for.loop.exit
+
+for.loop.exit:
+ ret void
+}
+
+; CHECK-LABEL: test_modulo_analysis_with_global
+; CHECK: PartialAlias: i32** %x, i32** %y
+
+define void @test_modulo_analysis_with_global() {
+ %h = alloca [1 x [2 x i32*]], align 16
+ %b = load i32* @b, align 4
+ %b.promoted = sext i32 %b to i64
+ br label %for.loop
+
+for.loop:
+ %i = phi i32 [ 0, %0 ], [ %i.plus1, %for.loop ]
+ %i.promoted = sext i32 %i to i64
+ %x = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 %i.promoted, i64 %b.promoted
+ %y = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 0, i64 1
+ %i.plus1 = add nsw i32 %i, 1
+ %cmp = icmp slt i32 %i.plus1, 2
+ br i1 %cmp, label %for.loop, label %for.loop.exit
+
+for.loop.exit:
+ ret void
+}
+
+; CHECK-LABEL: test_const_eval
+; CHECK: NoAlias: i8* %a, i8* %b
+define void @test_const_eval(i8* %ptr, i64 %offset) {
+ %a = getelementptr inbounds i8* %ptr, i64 %offset
+ %a.dup = getelementptr inbounds i8* %ptr, i64 %offset
+ %three = zext i32 3 to i64
+ %b = getelementptr inbounds i8* %a.dup, i64 %three
+ ret void
+}
+
+; CHECK-LABEL: test_const_eval_scaled
+; CHECK: MustAlias: i8* %a, i8* %b
+define void @test_const_eval_scaled(i8* %ptr) {
+ %three = zext i32 3 to i64
+ %six = mul i64 %three, 2
+ %a = getelementptr inbounds i8* %ptr, i64 %six
+ %b = getelementptr inbounds i8* %ptr, i64 6
+ ret void
+}
+
+; Function Attrs: nounwind
+declare noalias i8* @malloc(i64)
diff --git a/test/Analysis/CFLAliasAnalysis/arguments-globals.ll b/test/Analysis/CFLAliasAnalysis/arguments-globals.ll
new file mode 100644
index 0000000..18bbe8b
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/arguments-globals.ll
@@ -0,0 +1,20 @@
+; This testcase ensures that CFL AA gives conservative answers on variables
+; that involve arguments.
+; (Everything should alias everything, because args can alias globals, so the
+; aliasing sets should of args+alloca+global should be combined)
+
+; RUN: opt < %s -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+; CHECK: Function: test
+
+@g = external global i32
+
+define void @test(i1 %c, i32* %arg1, i32* %arg2) {
+ ; CHECK: 15 Total Alias Queries Performed
+ ; CHECK: 0 no alias responses
+ %A = alloca i32, align 4
+ %B = select i1 %c, i32* %arg1, i32* %arg2
+ %C = select i1 %c, i32* @g, i32* %A
+
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/arguments.ll b/test/Analysis/CFLAliasAnalysis/arguments.ll
new file mode 100644
index 0000000..f3e6679
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/arguments.ll
@@ -0,0 +1,15 @@
+; This testcase ensures that CFL AA gives conservative answers on variables
+; that involve arguments.
+
+; RUN: opt < %s -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+; CHECK: Function: test
+
+define void @test(i1 %c, i32* %arg1, i32* %arg2) {
+ ; CHECK: 6 Total Alias Queries Performed
+ ; CHECK: 3 no alias responses
+ %a = alloca i32, align 4
+ %b = select i1 %c, i32* %arg1, i32* %arg2
+
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/basic-interproc-ret.ll b/test/Analysis/CFLAliasAnalysis/basic-interproc-ret.ll
new file mode 100644
index 0000000..d56a455
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/basic-interproc-ret.ll
@@ -0,0 +1,26 @@
+; This testcase ensures that CFL AA gives conservative answers on variables
+; that involve arguments.
+
+; RUN: opt < %s -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+; CHECK: Function: test
+; CHECK: 4 Total Alias Queries Performed
+; CHECK: 3 no alias responses
+; ^ The 1 MayAlias is due to %arg1. Sadly, we don't currently have machinery
+; in place to check whether %arg1 aliases %a, because BasicAA takes care of
+; that for us.
+
+define i32* @test2(i32* %arg1) {
+ store i32 0, i32* %arg1
+
+ %a = alloca i32, align 4
+ ret i32* %a
+}
+
+define void @test() {
+ %a = alloca i32, align 4
+ %b = alloca i32, align 4
+ %c = call i32* @test2(i32* %a)
+
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/basic-interproc.ll b/test/Analysis/CFLAliasAnalysis/basic-interproc.ll
new file mode 100644
index 0000000..c0a5404
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/basic-interproc.ll
@@ -0,0 +1,24 @@
+; This testcase ensures that CFL AA gives conservative answers on variables
+; that involve arguments.
+
+; RUN: opt < %s -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+; CHECK: Function: test
+; CHECK: 2 Total Alias Queries Performed
+; CHECK: 1 no alias responses
+; ^^ In @test2, %arg1 and %arg2 may alias
+
+define void @test2(i32* %arg1, i32* %arg2) {
+ store i32 0, i32* %arg1
+ store i32 0, i32* %arg2
+
+ ret void
+}
+
+define void @test() {
+ %a = alloca i32, align 4
+ %b = alloca i32, align 4
+ call void @test2(i32* %a, i32* %b)
+
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll b/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
new file mode 100644
index 0000000..9ae200b
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/const-expr-gep.ll
@@ -0,0 +1,21 @@
+; This testcase consists of alias relations which should be completely
+; resolvable by cfl-aa, but require analysis of getelementptr constant exprs.
+; Derived from BasicAA/2003-12-11-ConstExprGEP.ll
+
+; RUN: opt < %s -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+%T = type { i32, [10 x i8] }
+
+@G = external global %T
+
+; CHECK: Function: test
+; CHECK-NOT: May:
+
+define void @test() {
+ %D = getelementptr %T* @G, i64 0, i32 0
+ %E = getelementptr %T* @G, i64 0, i32 1, i64 5
+ %F = getelementptr i32* getelementptr (%T* @G, i64 0, i32 0), i64 0
+ %X = getelementptr [10 x i8]* getelementptr (%T* @G, i64 0, i32 1), i64 0, i64 5
+
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/constant-over-index.ll b/test/Analysis/CFLAliasAnalysis/constant-over-index.ll
new file mode 100644
index 0000000..fb44b95
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/constant-over-index.ll
@@ -0,0 +1,30 @@
+; RUN: opt < %s -cfl-aa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
+
+; CFL AA currently returns PartialAlias, BasicAA returns MayAlias, both seem
+; acceptable (although we might decide that we don't want PartialAlias, and if
+; so, we should update this test case accordingly).
+; CHECK: {{PartialAlias|MayAlias}}: double* %p.0.i.0, double* %p3
+
+; %p3 is equal to %p.0.i.0 on the second iteration of the loop,
+; so MayAlias is needed.
+
+define void @foo([3 x [3 x double]]* noalias %p) {
+entry:
+ %p3 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 0, i64 3
+ br label %loop
+
+loop:
+ %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
+
+ %p.0.i.0 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %i, i64 0
+
+ store volatile double 0.0, double* %p3
+ store volatile double 0.1, double* %p.0.i.0
+
+ %i.next = add i64 %i, 1
+ %cmp = icmp slt i64 %i.next, 3
+ br i1 %cmp, label %loop, label %exit
+
+exit:
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/empty.ll b/test/Analysis/CFLAliasAnalysis/empty.ll
new file mode 100644
index 0000000..907fa48
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/empty.ll
@@ -0,0 +1,12 @@
+; RUN: opt < %s -cfl-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | 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-n8:16:32:64"
+
+; CHECK: Function: foo:
+; CHECK-NEXT: NoAlias: {}* %p, {}* %q
+
+define void @foo({}* %p, {}* %q) {
+ store {} {}, {}* %p
+ store {} {}, {}* %q
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/full-store-partial-alias.ll b/test/Analysis/CFLAliasAnalysis/full-store-partial-alias.ll
new file mode 100644
index 0000000..155fe13
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/full-store-partial-alias.ll
@@ -0,0 +1,37 @@
+; RUN: opt -S -tbaa -cfl-aa -gvn < %s | FileCheck -check-prefix=CFLAA %s
+; RUN: opt -S -tbaa -gvn < %s | FileCheck %s
+; Adapted from the BasicAA full-store-partial-alias.ll test.
+
+; CFL AA should notice that the store stores to the entire %u object,
+; so the %tmp5 load is PartialAlias with the store and suppress TBAA.
+; Without CFL AA, TBAA should say that %tmp5 is NoAlias with the store.
+
+target datalayout = "e-p:64:64:64"
+
+%union.anon = type { double }
+
+@u = global %union.anon { double -2.500000e-01 }, align 8
+@endianness_test = global i64 1, align 8
+
+define i32 @signbit(double %x) nounwind {
+; CFLAA: ret i32 %tmp5.lobit
+; CHECK: ret i32 0
+entry:
+ %u = alloca %union.anon, align 8
+ %tmp9 = getelementptr inbounds %union.anon* %u, i64 0, i32 0
+ store double %x, double* %tmp9, align 8, !tbaa !0
+ %tmp2 = load i32* bitcast (i64* @endianness_test to i32*), align 8, !tbaa !3
+ %idxprom = sext i32 %tmp2 to i64
+ %tmp4 = bitcast %union.anon* %u to [2 x i32]*
+ %arrayidx = getelementptr inbounds [2 x i32]* %tmp4, i64 0, i64 %idxprom
+ %tmp5 = load i32* %arrayidx, align 4, !tbaa !3
+ %tmp5.lobit = lshr i32 %tmp5, 31
+ ret i32 %tmp5.lobit
+}
+
+!0 = metadata !{metadata !4, metadata !4, i64 0}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
+!3 = metadata !{metadata !5, metadata !5, i64 0}
+!4 = metadata !{metadata !"double", metadata !1}
+!5 = metadata !{metadata !"int", metadata !1}
diff --git a/test/Analysis/CFLAliasAnalysis/gep-signed-arithmetic.ll b/test/Analysis/CFLAliasAnalysis/gep-signed-arithmetic.ll
new file mode 100644
index 0000000..a0195d7
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/gep-signed-arithmetic.ll
@@ -0,0 +1,17 @@
+; RUN: opt < %s -cfl-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
+; Derived from BasicAA/2010-09-15-GEP-SignedArithmetic.ll
+
+target datalayout = "e-p:32:32:32"
+
+; CHECK: 1 partial alias response
+
+define i32 @test(i32* %tab, i32 %indvar) nounwind {
+ %tmp31 = mul i32 %indvar, -2
+ %tmp32 = add i32 %tmp31, 30
+ %t.5 = getelementptr i32* %tab, i32 %tmp32
+ %loada = load i32* %tab
+ store i32 0, i32* %t.5
+ %loadb = load i32* %tab
+ %rval = add i32 %loada, %loadb
+ ret i32 %rval
+}
diff --git a/test/Analysis/CFLAliasAnalysis/multilevel-combine.ll b/test/Analysis/CFLAliasAnalysis/multilevel-combine.ll
new file mode 100644
index 0000000..9bbc721
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/multilevel-combine.ll
@@ -0,0 +1,31 @@
+; This testcase ensures that CFL AA responds conservatively when we union
+; groups of pointers together through ternary/conditional operations
+; Derived from:
+; void foo(bool c) {
+; char a, b;
+; char *m = c ? &a : &b;
+; *m;
+; }
+;
+
+; RUN: opt < %s -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+%T = type { i32, [10 x i8] }
+
+; CHECK: Function: test
+
+define void @test(i1 %C) {
+; CHECK: 10 Total Alias Queries Performed
+; CHECK: 4 no alias responses
+ %M = alloca %T*, align 8 ; NoAlias with %A, %B, %MS, %AP
+ %A = alloca %T, align 8
+ %B = alloca %T, align 8
+
+ %MS = select i1 %C, %T* %B, %T* %A
+
+ store %T* %MS, %T** %M
+
+ %AP = load %T** %M ; PartialAlias with %A, %B
+
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/multilevel.ll b/test/Analysis/CFLAliasAnalysis/multilevel.ll
new file mode 100644
index 0000000..9c9eb9a
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/multilevel.ll
@@ -0,0 +1,30 @@
+; This testcase ensures that CFL AA handles trivial cases with storing
+; pointers in pointers appropriately.
+; Derived from:
+; char a, b;
+; char *m = &a, *n = &b;
+; *m;
+; *n;
+
+; RUN: opt < %s -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+%T = type { i32, [10 x i8] }
+
+; CHECK: Function: test
+
+define void @test() {
+; CHECK: 15 Total Alias Queries Performed
+; CHECK: 13 no alias responses
+ %M = alloca %T*, align 8
+ %N = alloca %T*, align 8
+ %A = alloca %T, align 8
+ %B = alloca %T, align 8
+
+ store %T* %A, %T** %M
+ store %T* %B, %T** %N
+
+ %AP = load %T** %M ; PartialAlias with %A
+ %BP = load %T** %N ; PartialAlias with %B
+
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/must-and-partial.ll b/test/Analysis/CFLAliasAnalysis/must-and-partial.ll
new file mode 100644
index 0000000..df7de38
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/must-and-partial.ll
@@ -0,0 +1,39 @@
+; RUN: opt < %s -cfl-aa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
+
+; When merging MustAlias and PartialAlias, merge to PartialAlias
+; instead of MayAlias.
+
+
+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"
+
+; CHECK: PartialAlias: i16* %bigbase0, i8* %phi
+define i8 @test0(i8* %base, i1 %x) {
+entry:
+ %baseplusone = getelementptr i8* %base, i64 1
+ br i1 %x, label %red, label %green
+red:
+ br label %green
+green:
+ %phi = phi i8* [ %baseplusone, %red ], [ %base, %entry ]
+ store i8 0, i8* %phi
+
+ %bigbase0 = bitcast i8* %base to i16*
+ store i16 -1, i16* %bigbase0
+
+ %loaded = load i8* %phi
+ ret i8 %loaded
+}
+
+; CHECK: PartialAlias: i16* %bigbase1, i8* %sel
+define i8 @test1(i8* %base, i1 %x) {
+entry:
+ %baseplusone = getelementptr i8* %base, i64 1
+ %sel = select i1 %x, i8* %baseplusone, i8* %base
+ store i8 0, i8* %sel
+
+ %bigbase1 = bitcast i8* %base to i16*
+ store i16 -1, i16* %bigbase1
+
+ %loaded = load i8* %sel
+ ret i8 %loaded
+}
diff --git a/test/Analysis/CFLAliasAnalysis/phi-and-select.ll b/test/Analysis/CFLAliasAnalysis/phi-and-select.ll
new file mode 100644
index 0000000..a0e71a7
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/phi-and-select.ll
@@ -0,0 +1,36 @@
+; RUN: opt < %s -cfl-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
+; Derived from (a subset of) BasicAA/phi-and-select.ll
+
+; CHECK: Function: qux
+; CHECK: NoAlias: double* %a, double* %b
+; CHECK: ===== Alias Analysis Evaluator Report =====
+
+; Two PHIs with disjoint sets of inputs.
+define void @qux(i1 %m, double* noalias %x, double* noalias %y,
+ i1 %n, double* noalias %v, double* noalias %w) {
+entry:
+ br i1 %m, label %true, label %false
+
+true:
+ br label %exit
+
+false:
+ br label %exit
+
+exit:
+ %a = phi double* [ %x, %true ], [ %y, %false ]
+ br i1 %n, label %ntrue, label %nfalse
+
+ntrue:
+ br label %nexit
+
+nfalse:
+ br label %nexit
+
+nexit:
+ %b = phi double* [ %v, %ntrue ], [ %w, %nfalse ]
+ store volatile double 0.0, double* %a
+ store volatile double 1.0, double* %b
+ ret void
+}
+
diff --git a/test/Analysis/CFLAliasAnalysis/simple.ll b/test/Analysis/CFLAliasAnalysis/simple.ll
new file mode 100644
index 0000000..7bc455a
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/simple.ll
@@ -0,0 +1,18 @@
+; This testcase consists of alias relations which should be completely
+; resolvable by cfl-aa (derived from BasicAA/2003-11-04-SimpleCases.ll).
+
+; RUN: opt < %s -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+%T = type { i32, [10 x i8] }
+
+; CHECK: Function: test
+; CHECK-NOT: May:
+
+define void @test(%T* %P) {
+ %A = getelementptr %T* %P, i64 0
+ %B = getelementptr %T* %P, i64 0, i32 0
+ %C = getelementptr %T* %P, i64 0, i32 1
+ %D = getelementptr %T* %P, i64 0, i32 1, i64 0
+ %E = getelementptr %T* %P, i64 0, i32 1, i64 5
+ ret void
+}
diff --git a/test/Analysis/CFLAliasAnalysis/va.ll b/test/Analysis/CFLAliasAnalysis/va.ll
new file mode 100644
index 0000000..3094cb0
--- /dev/null
+++ b/test/Analysis/CFLAliasAnalysis/va.ll
@@ -0,0 +1,29 @@
+; RUN: opt < %s -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+; CHECK-LABEL: Function: test1
+; CHECK: 0 no alias responses
+
+define i32 @test1(i32 %X, ...) {
+ ; Initialize variable argument processing
+ %ap = alloca i8*
+ %ap2 = bitcast i8** %ap to i8*
+ call void @llvm.va_start(i8* %ap2)
+
+ ; Read a single integer argument
+ %tmp = va_arg i8** %ap, i32
+
+ ; Demonstrate usage of llvm.va_copy and llvm.va_end
+ %aq = alloca i8*
+ %aq2 = bitcast i8** %aq to i8*
+ call void @llvm.va_copy(i8* %aq2, i8* %ap2)
+ call void @llvm.va_end(i8* %aq2)
+
+ ; Stop processing of arguments.
+ call void @llvm.va_end(i8* %ap2)
+ ret i32 %tmp
+}
+
+declare void @llvm.va_start(i8*)
+declare void @llvm.va_copy(i8*, i8*)
+declare void @llvm.va_end(i8*)
+
diff --git a/test/Analysis/CostModel/ARM/cast.ll b/test/Analysis/CostModel/ARM/cast.ll
index 662110f..18d6e84 100644
--- a/test/Analysis/CostModel/ARM/cast.ll
+++ b/test/Analysis/CostModel/ARM/cast.ll
@@ -221,35 +221,35 @@ define i32 @casts() {
%r96 = fptoui <2 x float> undef to <2 x i32>
; CHECK: cost of 1 {{.*}} fptosi
%r97 = fptosi <2 x float> undef to <2 x i32>
- ; CHECK: cost of 28 {{.*}} fptoui
+ ; CHECK: cost of 32 {{.*}} fptoui
%r98 = fptoui <2 x float> undef to <2 x i64>
- ; CHECK: cost of 28 {{.*}} fptosi
+ ; CHECK: cost of 32 {{.*}} fptosi
%r99 = fptosi <2 x float> undef to <2 x i64>
- ; CHECK: cost of 8 {{.*}} fptoui
+ ; CHECK: cost of 16 {{.*}} fptoui
%r100 = fptoui <2 x double> undef to <2 x i1>
- ; CHECK: cost of 8 {{.*}} fptosi
+ ; CHECK: cost of 16 {{.*}} fptosi
%r101 = fptosi <2 x double> undef to <2 x i1>
- ; CHECK: cost of 8 {{.*}} fptoui
+ ; CHECK: cost of 16 {{.*}} fptoui
%r102 = fptoui <2 x double> undef to <2 x i8>
- ; CHECK: cost of 8 {{.*}} fptosi
+ ; CHECK: cost of 16 {{.*}} fptosi
%r103 = fptosi <2 x double> undef to <2 x i8>
- ; CHECK: cost of 8 {{.*}} fptoui
+ ; CHECK: cost of 16 {{.*}} fptoui
%r104 = fptoui <2 x double> undef to <2 x i16>
- ; CHECK: cost of 8 {{.*}} fptosi
+ ; CHECK: cost of 16 {{.*}} fptosi
%r105 = fptosi <2 x double> undef to <2 x i16>
; CHECK: cost of 2 {{.*}} fptoui
%r106 = fptoui <2 x double> undef to <2 x i32>
; CHECK: cost of 2 {{.*}} fptosi
%r107 = fptosi <2 x double> undef to <2 x i32>
- ; CHECK: cost of 28 {{.*}} fptoui
+ ; CHECK: cost of 32 {{.*}} fptoui
%r108 = fptoui <2 x double> undef to <2 x i64>
- ; CHECK: cost of 28 {{.*}} fptosi
+ ; CHECK: cost of 32 {{.*}} fptosi
%r109 = fptosi <2 x double> undef to <2 x i64>
- ; CHECK: cost of 16 {{.*}} fptoui
+ ; CHECK: cost of 32 {{.*}} fptoui
%r110 = fptoui <4 x float> undef to <4 x i1>
- ; CHECK: cost of 16 {{.*}} fptosi
+ ; CHECK: cost of 32 {{.*}} fptosi
%r111 = fptosi <4 x float> undef to <4 x i1>
; CHECK: cost of 3 {{.*}} fptoui
%r112 = fptoui <4 x float> undef to <4 x i8>
@@ -263,39 +263,39 @@ define i32 @casts() {
%r116 = fptoui <4 x float> undef to <4 x i32>
; CHECK: cost of 1 {{.*}} fptosi
%r117 = fptosi <4 x float> undef to <4 x i32>
- ; CHECK: cost of 56 {{.*}} fptoui
+ ; CHECK: cost of 64 {{.*}} fptoui
%r118 = fptoui <4 x float> undef to <4 x i64>
- ; CHECK: cost of 56 {{.*}} fptosi
+ ; CHECK: cost of 64 {{.*}} fptosi
%r119 = fptosi <4 x float> undef to <4 x i64>
- ; CHECK: cost of 16 {{.*}} fptoui
+ ; CHECK: cost of 32 {{.*}} fptoui
%r120 = fptoui <4 x double> undef to <4 x i1>
- ; CHECK: cost of 16 {{.*}} fptosi
+ ; CHECK: cost of 32 {{.*}} fptosi
%r121 = fptosi <4 x double> undef to <4 x i1>
- ; CHECK: cost of 16 {{.*}} fptoui
+ ; CHECK: cost of 32 {{.*}} fptoui
%r122 = fptoui <4 x double> undef to <4 x i8>
- ; CHECK: cost of 16 {{.*}} fptosi
+ ; CHECK: cost of 32 {{.*}} fptosi
%r123 = fptosi <4 x double> undef to <4 x i8>
- ; CHECK: cost of 16 {{.*}} fptoui
+ ; CHECK: cost of 32 {{.*}} fptoui
%r124 = fptoui <4 x double> undef to <4 x i16>
- ; CHECK: cost of 16 {{.*}} fptosi
+ ; CHECK: cost of 32 {{.*}} fptosi
%r125 = fptosi <4 x double> undef to <4 x i16>
- ; CHECK: cost of 16 {{.*}} fptoui
+ ; CHECK: cost of 32 {{.*}} fptoui
%r126 = fptoui <4 x double> undef to <4 x i32>
- ; CHECK: cost of 16 {{.*}} fptosi
+ ; CHECK: cost of 32 {{.*}} fptosi
%r127 = fptosi <4 x double> undef to <4 x i32>
- ; CHECK: cost of 56 {{.*}} fptoui
+ ; CHECK: cost of 64 {{.*}} fptoui
%r128 = fptoui <4 x double> undef to <4 x i64>
- ; CHECK: cost of 56 {{.*}} fptosi
+ ; CHECK: cost of 64 {{.*}} fptosi
%r129 = fptosi <4 x double> undef to <4 x i64>
- ; CHECK: cost of 32 {{.*}} fptoui
+ ; CHECK: cost of 64 {{.*}} fptoui
%r130 = fptoui <8 x float> undef to <8 x i1>
- ; CHECK: cost of 32 {{.*}} fptosi
+ ; CHECK: cost of 64 {{.*}} fptosi
%r131 = fptosi <8 x float> undef to <8 x i1>
- ; CHECK: cost of 32 {{.*}} fptoui
+ ; CHECK: cost of 64 {{.*}} fptoui
%r132 = fptoui <8 x float> undef to <8 x i8>
- ; CHECK: cost of 32 {{.*}} fptosi
+ ; CHECK: cost of 64 {{.*}} fptosi
%r133 = fptosi <8 x float> undef to <8 x i8>
; CHECK: cost of 4 {{.*}} fptoui
%r134 = fptoui <8 x float> undef to <8 x i16>
@@ -305,39 +305,39 @@ define i32 @casts() {
%r136 = fptoui <8 x float> undef to <8 x i32>
; CHECK: cost of 2 {{.*}} fptosi
%r137 = fptosi <8 x float> undef to <8 x i32>
- ; CHECK: cost of 112 {{.*}} fptoui
+ ; CHECK: cost of 128 {{.*}} fptoui
%r138 = fptoui <8 x float> undef to <8 x i64>
- ; CHECK: cost of 112 {{.*}} fptosi
+ ; CHECK: cost of 128 {{.*}} fptosi
%r139 = fptosi <8 x float> undef to <8 x i64>
- ; CHECK: cost of 32 {{.*}} fptoui
+ ; CHECK: cost of 64 {{.*}} fptoui
%r140 = fptoui <8 x double> undef to <8 x i1>
- ; CHECK: cost of 32 {{.*}} fptosi
+ ; CHECK: cost of 64 {{.*}} fptosi
%r141 = fptosi <8 x double> undef to <8 x i1>
- ; CHECK: cost of 32 {{.*}} fptoui
+ ; CHECK: cost of 64 {{.*}} fptoui
%r142 = fptoui <8 x double> undef to <8 x i8>
- ; CHECK: cost of 32 {{.*}} fptosi
+ ; CHECK: cost of 64 {{.*}} fptosi
%r143 = fptosi <8 x double> undef to <8 x i8>
- ; CHECK: cost of 32 {{.*}} fptoui
+ ; CHECK: cost of 64 {{.*}} fptoui
%r144 = fptoui <8 x double> undef to <8 x i16>
- ; CHECK: cost of 32 {{.*}} fptosi
+ ; CHECK: cost of 64 {{.*}} fptosi
%r145 = fptosi <8 x double> undef to <8 x i16>
- ; CHECK: cost of 32 {{.*}} fptoui
+ ; CHECK: cost of 64 {{.*}} fptoui
%r146 = fptoui <8 x double> undef to <8 x i32>
- ; CHECK: cost of 32 {{.*}} fptosi
+ ; CHECK: cost of 64 {{.*}} fptosi
%r147 = fptosi <8 x double> undef to <8 x i32>
- ; CHECK: cost of 112 {{.*}} fptoui
+ ; CHECK: cost of 128 {{.*}} fptoui
%r148 = fptoui <8 x double> undef to <8 x i64>
- ; CHECK: cost of 112 {{.*}} fptosi
+ ; CHECK: cost of 128 {{.*}} fptosi
%r149 = fptosi <8 x double> undef to <8 x i64>
- ; CHECK: cost of 64 {{.*}} fptoui
+ ; CHECK: cost of 128 {{.*}} fptoui
%r150 = fptoui <16 x float> undef to <16 x i1>
- ; CHECK: cost of 64 {{.*}} fptosi
+ ; CHECK: cost of 128 {{.*}} fptosi
%r151 = fptosi <16 x float> undef to <16 x i1>
- ; CHECK: cost of 64 {{.*}} fptoui
+ ; CHECK: cost of 128 {{.*}} fptoui
%r152 = fptoui <16 x float> undef to <16 x i8>
- ; CHECK: cost of 64 {{.*}} fptosi
+ ; CHECK: cost of 128 {{.*}} fptosi
%r153 = fptosi <16 x float> undef to <16 x i8>
; CHECK: cost of 8 {{.*}} fptoui
%r154 = fptoui <16 x float> undef to <16 x i16>
@@ -347,30 +347,30 @@ define i32 @casts() {
%r156 = fptoui <16 x float> undef to <16 x i32>
; CHECK: cost of 4 {{.*}} fptosi
%r157 = fptosi <16 x float> undef to <16 x i32>
- ; CHECK: cost of 224 {{.*}} fptoui
+ ; CHECK: cost of 256 {{.*}} fptoui
%r158 = fptoui <16 x float> undef to <16 x i64>
- ; CHECK: cost of 224 {{.*}} fptosi
+ ; CHECK: cost of 256 {{.*}} fptosi
%r159 = fptosi <16 x float> undef to <16 x i64>
- ; CHECK: cost of 64 {{.*}} fptoui
+ ; CHECK: cost of 128 {{.*}} fptoui
%r160 = fptoui <16 x double> undef to <16 x i1>
- ; CHECK: cost of 64 {{.*}} fptosi
+ ; CHECK: cost of 128 {{.*}} fptosi
%r161 = fptosi <16 x double> undef to <16 x i1>
- ; CHECK: cost of 64 {{.*}} fptoui
+ ; CHECK: cost of 128 {{.*}} fptoui
%r162 = fptoui <16 x double> undef to <16 x i8>
- ; CHECK: cost of 64 {{.*}} fptosi
+ ; CHECK: cost of 128 {{.*}} fptosi
%r163 = fptosi <16 x double> undef to <16 x i8>
- ; CHECK: cost of 64 {{.*}} fptoui
+ ; CHECK: cost of 128 {{.*}} fptoui
%r164 = fptoui <16 x double> undef to <16 x i16>
- ; CHECK: cost of 64 {{.*}} fptosi
+ ; CHECK: cost of 128 {{.*}} fptosi
%r165 = fptosi <16 x double> undef to <16 x i16>
- ; CHECK: cost of 64 {{.*}} fptoui
+ ; CHECK: cost of 128 {{.*}} fptoui
%r166 = fptoui <16 x double> undef to <16 x i32>
- ; CHECK: cost of 64 {{.*}} fptosi
+ ; CHECK: cost of 128 {{.*}} fptosi
%r167 = fptosi <16 x double> undef to <16 x i32>
- ; CHECK: cost of 224 {{.*}} fptoui
+ ; CHECK: cost of 256 {{.*}} fptoui
%r168 = fptoui <16 x double> undef to <16 x i64>
- ; CHECK: cost of 224 {{.*}} fptosi
+ ; CHECK: cost of 256 {{.*}} fptosi
%r169 = fptosi <16 x double> undef to <16 x i64>
; CHECK: cost of 8 {{.*}} uitofp
diff --git a/test/Analysis/CostModel/PowerPC/cmp-expanded.ll b/test/Analysis/CostModel/PowerPC/cmp-expanded.ll
new file mode 100644
index 0000000..38c8439
--- /dev/null
+++ b/test/Analysis/CostModel/PowerPC/cmp-expanded.ll
@@ -0,0 +1,14 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx | FileCheck %s
+target datalayout = "E-m:e-i64:64-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+define void @exts() {
+
+ ; VSX is disabled, so this cost needs to include scalarization (because
+ ; <4 x double> is legalized to scalars).
+ ; CHECK: cost of 44 {{.*}} fcmp
+ %v1 = fcmp ugt <4 x double> undef, undef
+
+ ret void
+}
+
diff --git a/test/Analysis/CostModel/X86/cast.ll b/test/Analysis/CostModel/X86/cast.ll
index 7f97b17..fb16af6 100644
--- a/test/Analysis/CostModel/X86/cast.ll
+++ b/test/Analysis/CostModel/X86/cast.ll
@@ -1,3 +1,4 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=knl | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AVX512
; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core-avx2 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AVX2
; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AVX
@@ -83,6 +84,19 @@ define i32 @zext_sext(<8 x i1> %in) {
;CHECK-AVX: cost of 4 {{.*}} zext
%D = zext <4 x i32> undef to <4 x i64>
+ ;CHECK-AVX512: cost of 3 {{.*}} %D1 = zext
+ %D1 = zext <16 x i32> undef to <16 x i64>
+
+ ;CHECK-AVX512: cost of 3 {{.*}} %D2 = sext
+ %D2 = sext <16 x i32> undef to <16 x i64>
+
+ ;CHECK-AVX512: cost of 1 {{.*}} %D3 = zext
+ %D3 = zext <16 x i16> undef to <16 x i32>
+ ;CHECK-AVX512: cost of 1 {{.*}} %D4 = zext
+ %D4 = zext <16 x i8> undef to <16 x i32>
+ ;CHECK-AVX512: cost of 2 {{.*}} %D5 = zext
+ %D5 = zext <16 x i1> undef to <16 x i32>
+
;CHECK-AVX2: cost of 2 {{.*}} trunc
;CHECK-AVX: cost of 4 {{.*}} trunc
%E = trunc <4 x i64> undef to <4 x i32>
@@ -101,8 +115,12 @@ define i32 @zext_sext(<8 x i1> %in) {
;CHECK-AVX2: cost of 4 {{.*}} trunc
;CHECK-AVX: cost of 9 {{.*}} trunc
+ ;CHECK_AVX512: cost of 1 {{.*}} G = trunc
%G = trunc <8 x i64> undef to <8 x i32>
+ ;CHECK-AVX512: cost of 4 {{.*}} %G1 = trunc
+ %G1 = trunc <16 x i64> undef to <16 x i32>
+
ret i32 undef
}
@@ -207,7 +225,30 @@ define void @uitofp8(<8 x i1> %a, <8 x i8> %b, <8 x i16> %c, <8 x i32> %d) {
; CHECK: cost of 5 {{.*}} uitofp
%C1 = uitofp <8 x i16> %c to <8 x float>
- ; CHECK: cost of 9 {{.*}} uitofp
+ ; CHECK-AVX2: cost of 8 {{.*}} uitofp
+ ; CHECK-AVX512: cost of 8 {{.*}} uitofp
+ ; CHECK-AVX: cost of 9 {{.*}} uitofp
%D1 = uitofp <8 x i32> %d to <8 x float>
ret void
}
+
+define void @fp_conv(<8 x float> %a, <16 x float>%b) {
+;CHECK-LABEL: for function 'fp_conv'
+ ; CHECK-AVX512: cost of 1 {{.*}} fpext
+ %A1 = fpext <8 x float> %a to <8 x double>
+
+ ; CHECK-AVX512: cost of 3 {{.*}} fpext
+ %A2 = fpext <16 x float> %b to <16 x double>
+
+ ; CHECK-AVX2: cost of 3 {{.*}} %A3 = fpext
+ ; CHECK-AVX512: cost of 1 {{.*}} %A3 = fpext
+ %A3 = fpext <8 x float> %a to <8 x double>
+
+ ; CHECK-AVX2: cost of 3 {{.*}} %A4 = fptrunc
+ ; CHECK-AVX512: cost of 1 {{.*}} %A4 = fptrunc
+ %A4 = fptrunc <8 x double> undef to <8 x float>
+
+ ; CHECK-AVX512: cost of 3 {{.*}} %A5 = fptrunc
+ %A5 = fptrunc <16 x double> undef to <16 x float>
+ ret void
+}
diff --git a/test/Analysis/CostModel/X86/cmp.ll b/test/Analysis/CostModel/X86/cmp.ll
index 9f2bdb3..469cd73 100644
--- a/test/Analysis/CostModel/X86/cmp.ll
+++ b/test/Analysis/CostModel/X86/cmp.ll
@@ -1,5 +1,6 @@
; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck -check-prefix=CHECK -check-prefix=AVX1 %s
; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core-avx2 | FileCheck -check-prefix=CHECK -check-prefix=AVX2 %s
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=knl | FileCheck -check-prefix=CHECK -check-prefix=AVX512 %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-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
@@ -22,6 +23,11 @@ define i32 @cmp(i32 %arg) {
;AVX2: cost of 1 {{.*}} fcmp
%E = fcmp olt <4 x double> undef, undef
+ ; AVX512: cost of 1 {{.*}} %E1 = fcmp
+ %E1 = fcmp olt <16 x float> undef, undef
+ ; AVX512: cost of 2 {{.*}} %E2 = fcmp
+ %E2 = fcmp olt <16 x double> undef, undef
+
; -- integers --
;AVX1: cost of 1 {{.*}} icmp
@@ -49,6 +55,11 @@ define i32 @cmp(i32 %arg) {
;AVX2: cost of 1 {{.*}} icmp
%M = icmp eq <32 x i8> undef, undef
+ ; AVX512: cost of 1 {{.*}} %M1 = icmp
+ %M1 = icmp eq <16 x i32> undef, undef
+ ; AVX512: cost of 2 {{.*}} %M2 = icmp
+ %M2 = icmp eq <16 x i64> undef, undef
+
;CHECK: cost of 0 {{.*}} ret
ret i32 undef
}
diff --git a/test/Analysis/CostModel/X86/sitofp.ll b/test/Analysis/CostModel/X86/sitofp.ll
index 338d974..edc937e 100644
--- a/test/Analysis/CostModel/X86/sitofp.ll
+++ b/test/Analysis/CostModel/X86/sitofp.ll
@@ -1,4 +1,5 @@
; RUN: opt -mtriple=x86_64-apple-darwin -mcpu=core2 -cost-model -analyze < %s | FileCheck --check-prefix=SSE2 %s
+; RUN: opt -mtriple=x86_64-apple-darwin -mcpu=knl -cost-model -analyze < %s | FileCheck --check-prefix=AVX512F %s
define <2 x double> @sitofpv2i8v2double(<2 x i8> %a) {
; SSE2: sitofpv2i8v2double
@@ -279,3 +280,47 @@ define <32 x float> @sitofpv32i64v32float(<32 x i64> %a) {
%1 = sitofp <32 x i64> %a to <32 x float>
ret <32 x float> %1
}
+
+; AVX512F-LABEL: sitofp_16i8_float
+; AVX512F: cost of 2 {{.*}} sitofp
+define <16 x float> @sitofp_16i8_float(<16 x i8> %a) {
+ %1 = sitofp <16 x i8> %a to <16 x float>
+ ret <16 x float> %1
+}
+
+define <16 x float> @sitofp_16i16_float(<16 x i16> %a) {
+ ; AVX512F-LABEL: sitofp_16i16_float
+ ; AVX512F: cost of 2 {{.*}} sitofp
+ %1 = sitofp <16 x i16> %a to <16 x float>
+ ret <16 x float> %1
+}
+
+; AVX512F-LABEL: sitofp_8i8_double
+; AVX512F: cost of 2 {{.*}} sitofp
+define <8 x double> @sitofp_8i8_double(<8 x i8> %a) {
+ %1 = sitofp <8 x i8> %a to <8 x double>
+ ret <8 x double> %1
+}
+
+; AVX512F-LABEL: sitofp_8i16_double
+; AVX512F: cost of 2 {{.*}} sitofp
+define <8 x double> @sitofp_8i16_double(<8 x i16> %a) {
+ %1 = sitofp <8 x i16> %a to <8 x double>
+ ret <8 x double> %1
+}
+
+; AVX512F-LABEL: sitofp_8i1_double
+; AVX512F: cost of 4 {{.*}} sitofp
+define <8 x double> @sitofp_8i1_double(<8 x double> %a) {
+ %cmpres = fcmp ogt <8 x double> %a, zeroinitializer
+ %1 = sitofp <8 x i1> %cmpres to <8 x double>
+ ret <8 x double> %1
+}
+
+; AVX512F-LABEL: sitofp_16i1_float
+; AVX512F: cost of 3 {{.*}} sitofp
+define <16 x float> @sitofp_16i1_float(<16 x float> %a) {
+ %cmpres = fcmp ogt <16 x float> %a, zeroinitializer
+ %1 = sitofp <16 x i1> %cmpres to <16 x float>
+ ret <16 x float> %1
+}
diff --git a/test/Analysis/CostModel/X86/uitofp.ll b/test/Analysis/CostModel/X86/uitofp.ll
index a41a04d..27ec268 100644
--- a/test/Analysis/CostModel/X86/uitofp.ll
+++ b/test/Analysis/CostModel/X86/uitofp.ll
@@ -235,7 +235,7 @@ define <2 x float> @uitofpv2i8v2float(<2 x i8> %a) {
define <4 x float> @uitofpv4i8v4float(<4 x i8> %a) {
; SSE2: uitofpv4i8v4float
- ; SSE2: cost of 15 {{.*}} uitofp
+ ; SSE2: cost of 8 {{.*}} uitofp
%1 = uitofp <4 x i8> %a to <4 x float>
ret <4 x float> %1
}
@@ -270,7 +270,7 @@ define <2 x float> @uitofpv2i16v2float(<2 x i16> %a) {
define <4 x float> @uitofpv4i16v4float(<4 x i16> %a) {
; SSE2: uitofpv4i16v4float
- ; SSE2: cost of 15 {{.*}} uitofp
+ ; SSE2: cost of 8 {{.*}} uitofp
%1 = uitofp <4 x i16> %a to <4 x float>
ret <4 x float> %1
}
@@ -305,28 +305,28 @@ define <2 x float> @uitofpv2i32v2float(<2 x i32> %a) {
define <4 x float> @uitofpv4i32v4float(<4 x i32> %a) {
; SSE2: uitofpv4i32v4float
- ; SSE2: cost of 15 {{.*}} uitofp
+ ; SSE2: cost of 8 {{.*}} uitofp
%1 = uitofp <4 x i32> %a to <4 x float>
ret <4 x float> %1
}
define <8 x float> @uitofpv8i32v8float(<8 x i32> %a) {
; SSE2: uitofpv8i32v8float
- ; SSE2: cost of 30 {{.*}} uitofp
+ ; SSE2: cost of 16 {{.*}} uitofp
%1 = uitofp <8 x i32> %a to <8 x float>
ret <8 x float> %1
}
define <16 x float> @uitofpv16i32v16float(<16 x i32> %a) {
; SSE2: uitofpv16i32v16float
- ; SSE2: cost of 60 {{.*}} uitofp
+ ; SSE2: cost of 32 {{.*}} uitofp
%1 = uitofp <16 x i32> %a to <16 x float>
ret <16 x float> %1
}
define <32 x float> @uitofpv32i32v32float(<32 x i32> %a) {
; SSE2: uitofpv32i32v32float
- ; SSE2: cost of 120 {{.*}} uitofp
+ ; SSE2: cost of 64 {{.*}} uitofp
%1 = uitofp <32 x i32> %a to <32 x float>
ret <32 x float> %1
}
diff --git a/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll b/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll
new file mode 100644
index 0000000..95e5e52
--- /dev/null
+++ b/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll
@@ -0,0 +1,40 @@
+; RUN: opt < %s -analyze -basicaa -da -da-delinearize=false | FileCheck %s
+; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s -check-prefix=DELIN
+
+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-S128"
+target triple = "x86_64-apple-macosx10.6.0"
+
+; for (int i = 0; i < 100; ++i) {
+; int t0 = a[i][i];
+; int t1 = t0 + 1;
+; a[i][5] = t1;
+; }
+; The subscript 5 in a[i][5] is deliberately an i32, mismatching the types of
+; other subscript. DependenceAnalysis before the fix crashed due to this
+; mismatch.
+define void @i32_subscript([100 x [100 x i32]]* %a, i32* %b) {
+; CHECK-LABEL: 'Dependence Analysis' for function 'i32_subscript'
+; DELIN-LABEL: 'Dependence Analysis' for function 'i32_subscript'
+entry:
+ br label %for.body
+
+for.body:
+; CHECK: da analyze - none!
+; CHECK: da analyze - anti [=|<]!
+; CHECK: da analyze - none!
+; DELIN: da analyze - none!
+; DELIN: da analyze - anti [=|<]!
+; DELIN: da analyze - none!
+ %i = phi i64 [ 0, %entry ], [ %i.inc, %for.body ]
+ %a.addr = getelementptr [100 x [100 x i32]]* %a, i64 0, i64 %i, i64 %i
+ %a.addr.2 = getelementptr [100 x [100 x i32]]* %a, i64 0, i64 %i, i32 5
+ %0 = load i32* %a.addr, align 4
+ %1 = add i32 %0, 1
+ store i32 %1, i32* %a.addr.2, align 4
+ %i.inc = add nsw i64 %i, 1
+ %exitcond = icmp ne i64 %i.inc, 100
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
diff --git a/test/Analysis/GlobalsModRef/pr12351.ll b/test/Analysis/GlobalsModRef/pr12351.ll
index 1c5ac43..c221f4c 100644
--- a/test/Analysis/GlobalsModRef/pr12351.ll
+++ b/test/Analysis/GlobalsModRef/pr12351.ll
@@ -26,8 +26,8 @@ define i32 @foo2() {
define void @bar2(i32* %foo) {
store i32 0, i32* %foo, align 4
- tail call void @llvm.dbg.value(metadata !{}, i64 0, metadata !{})
+ tail call void @llvm.dbg.value(metadata !{}, i64 0, metadata !{}, metadata !{})
ret void
}
-declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
+declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
diff --git a/test/Analysis/ScalarEvolution/load-with-range-metadata.ll b/test/Analysis/ScalarEvolution/load-with-range-metadata.ll
new file mode 100644
index 0000000..2f6dcd0
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/load-with-range-metadata.ll
@@ -0,0 +1,37 @@
+; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
+
+define i32 @slt_trip_count_with_range(i32 *%ptr0, i32 *%ptr1) {
+; CHECK-LABEL: slt_trip_count_with_range
+ entry:
+ %limit = load i32* %ptr0, !range !0
+ br label %loop
+
+ loop:
+; CHECK: Loop %loop: max backedge-taken count is 98
+ %index = phi i32 [ 0, %entry ], [ %index.inc, %loop ]
+ %index.inc = add i32 %index, 1
+ %continue = icmp slt i32 %index.inc, %limit
+ br i1 %continue, label %loop, label %loop.exit
+
+ loop.exit:
+ ret i32 0
+}
+
+define i32 @ult_trip_count_with_range(i32 *%ptr0, i32 *%ptr1) {
+; CHECK-LABEL: ult_trip_count_with_range
+ entry:
+ %limit = load i32* %ptr0, !range !0
+ br label %loop
+
+ loop:
+; CHECK: Loop %loop: max backedge-taken count is 98
+ %index = phi i32 [ 0, %entry ], [ %index.inc, %loop ]
+ %index.inc = add i32 %index, 1
+ %continue = icmp ult i32 %index.inc, %limit
+ br i1 %continue, label %loop, label %loop.exit
+
+ loop.exit:
+ ret i32 0
+}
+
+!0 = metadata !{i32 1, i32 100}
diff --git a/test/Analysis/ScalarEvolution/nsw-offset-assume.ll b/test/Analysis/ScalarEvolution/nsw-offset-assume.ll
new file mode 100644
index 0000000..29cf658
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/nsw-offset-assume.ll
@@ -0,0 +1,83 @@
+; RUN: opt < %s -S -analyze -scalar-evolution | FileCheck %s
+
+; ScalarEvolution should be able to fold away the sign-extensions
+; on this loop with a primary induction variable incremented with
+; a nsw add of 2 (this test is derived from the nsw-offset.ll test, but uses an
+; assume instead of a preheader conditional branch to guard the loop).
+
+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 @foo(i32 %no, double* nocapture %d, double* nocapture %q) nounwind {
+entry:
+ %n = and i32 %no, 4294967294
+ %0 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
+ tail call void @llvm.assume(i1 %0)
+ br label %bb.nph
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb.nph, %bb1
+ %i.01 = phi i32 [ %16, %bb1 ], [ 0, %bb.nph ] ; <i32> [#uses=5]
+
+; CHECK: %1 = sext i32 %i.01 to i64
+; CHECK: --> {0,+,2}<nuw><nsw><%bb>
+ %1 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
+
+; CHECK: %2 = getelementptr inbounds double* %d, i64 %1
+; CHECK: --> {%d,+,16}<nsw><%bb>
+ %2 = getelementptr inbounds double* %d, i64 %1 ; <double*> [#uses=1]
+
+ %3 = load double* %2, align 8 ; <double> [#uses=1]
+ %4 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
+ %5 = getelementptr inbounds double* %q, i64 %4 ; <double*> [#uses=1]
+ %6 = load double* %5, align 8 ; <double> [#uses=1]
+ %7 = or i32 %i.01, 1 ; <i32> [#uses=1]
+
+; CHECK: %8 = sext i32 %7 to i64
+; CHECK: --> {1,+,2}<nuw><nsw><%bb>
+ %8 = sext i32 %7 to i64 ; <i64> [#uses=1]
+
+; CHECK: %9 = getelementptr inbounds double* %q, i64 %8
+; CHECK: {(8 + %q),+,16}<nsw><%bb>
+ %9 = getelementptr inbounds double* %q, i64 %8 ; <double*> [#uses=1]
+
+; Artificially repeat the above three instructions, this time using
+; add nsw instead of or.
+ %t7 = add nsw i32 %i.01, 1 ; <i32> [#uses=1]
+
+; CHECK: %t8 = sext i32 %t7 to i64
+; CHECK: --> {1,+,2}<nuw><nsw><%bb>
+ %t8 = sext i32 %t7 to i64 ; <i64> [#uses=1]
+
+; CHECK: %t9 = getelementptr inbounds double* %q, i64 %t8
+; CHECK: {(8 + %q),+,16}<nsw><%bb>
+ %t9 = getelementptr inbounds double* %q, i64 %t8 ; <double*> [#uses=1]
+
+ %10 = load double* %9, align 8 ; <double> [#uses=1]
+ %11 = fadd double %6, %10 ; <double> [#uses=1]
+ %12 = fadd double %11, 3.200000e+00 ; <double> [#uses=1]
+ %13 = fmul double %3, %12 ; <double> [#uses=1]
+ %14 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
+ %15 = getelementptr inbounds double* %d, i64 %14 ; <double*> [#uses=1]
+ store double %13, double* %15, align 8
+ %16 = add nsw i32 %i.01, 2 ; <i32> [#uses=2]
+ br label %bb1
+
+bb1: ; preds = %bb
+ %17 = icmp slt i32 %16, %n ; <i1> [#uses=1]
+ br i1 %17, label %bb, label %bb1.return_crit_edge
+
+bb1.return_crit_edge: ; preds = %bb1
+ br label %return
+
+return: ; preds = %bb1.return_crit_edge, %entry
+ ret void
+}
+
+declare void @llvm.assume(i1) nounwind
+
+; Note: Without the preheader assume, there is an 'smax' in the
+; backedge-taken count expression:
+; CHECK: Loop %bb: backedge-taken count is ((-1 + (2 * (%no /u 2))) /u 2)
+; CHECK: Loop %bb: max backedge-taken count is 1073741822
diff --git a/test/Analysis/ScalarEvolution/nsw.ll b/test/Analysis/ScalarEvolution/nsw.ll
index 05992ea..d776a5a 100644
--- a/test/Analysis/ScalarEvolution/nsw.ll
+++ b/test/Analysis/ScalarEvolution/nsw.ll
@@ -123,9 +123,8 @@ exit:
ret i32 %result
}
-; TODO: This could fold down to '1'
; CHECK-LABEL: PR12375
-; CHECK: --> {(4 + %arg),+,4}<nuw><%bb1> Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg) umax (8 + %arg)<nsw>)) /u 4)) + %arg)
+; CHECK: --> {(4 + %arg),+,4}<nuw><%bb1> Exits: (8 + %arg)<nsw>
define i32 @PR12375(i32* readnone %arg) {
bb:
%tmp = getelementptr inbounds i32* %arg, i64 2
@@ -158,3 +157,23 @@ bb2: ; preds = %bb2, %bb
bb5: ; preds = %bb2
ret void
}
+
+declare void @f(i32)
+
+; CHECK-LABEL: nswnowrap
+; CHECK: --> {(1 + %v),+,1}<nsw><%for.body> Exits: (2 + %v)
+define void @nswnowrap(i32 %v) {
+entry:
+ %add = add nsw i32 %v, 1
+ br label %for.body
+
+for.body:
+ %i.04 = phi i32 [ %v, %entry ], [ %inc, %for.body ]
+ %inc = add nsw i32 %i.04, 1
+ tail call void @f(i32 %i.04)
+ %cmp = icmp slt i32 %i.04, %add
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
diff --git a/test/Analysis/ScalarEvolution/sext-iv-1.ll b/test/Analysis/ScalarEvolution/sext-iv-1.ll
index c34596d..a6f70db 100644
--- a/test/Analysis/ScalarEvolution/sext-iv-1.ll
+++ b/test/Analysis/ScalarEvolution/sext-iv-1.ll
@@ -1,5 +1,12 @@
; RUN: opt < %s -scalar-evolution -analyze \
-; RUN: | grep " --> (sext i. {.*,+,.*}<%bb1> to i64)" | count 5
+; RUN: | FileCheck %s
+
+; CHECK: --> (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
+; CHECK: --> (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
+; CHECK: --> (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
+; CHECK: --> (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
+; CHECK: --> (sext i{{.}} {{{.*}},+,{{.*}}}<%bb1> to i64)
+; CHECK-NOT: --> (sext
; Don't convert (sext {...,+,...}) to {sext(...),+,sext(...)} in cases
; where the trip count is not within range.
diff --git a/test/Analysis/ScopedNoAliasAA/basic-domains.ll b/test/Analysis/ScopedNoAliasAA/basic-domains.ll
new file mode 100644
index 0000000..d88a496
--- /dev/null
+++ b/test/Analysis/ScopedNoAliasAA/basic-domains.ll
@@ -0,0 +1,57 @@
+; RUN: opt < %s -basicaa -scoped-noalias -aa-eval -evaluate-aa-metadata -print-all-alias-modref-info -disable-output 2>&1 | 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-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @foo1(float* nocapture %a, float* nocapture readonly %c) #0 {
+entry:
+; CHECK-LABEL: Function: foo1
+ %0 = load float* %c, align 4, !alias.scope !9
+ %arrayidx.i = getelementptr inbounds float* %a, i64 5
+ store float %0, float* %arrayidx.i, align 4, !noalias !6
+
+ %1 = load float* %c, align 4, !alias.scope !5
+ %arrayidx.i2 = getelementptr inbounds float* %a, i64 15
+ store float %1, float* %arrayidx.i2, align 4, !noalias !6
+
+ %2 = load float* %c, align 4, !alias.scope !6
+ %arrayidx.i3 = getelementptr inbounds float* %a, i64 16
+ store float %2, float* %arrayidx.i3, align 4, !noalias !5
+
+ ret void
+}
+
+attributes #0 = { nounwind uwtable }
+
+!0 = metadata !{metadata !0, metadata !"some domain"}
+!1 = metadata !{metadata !1, metadata !"some other domain"}
+
+; Two scopes (which must be self-referential to avoid being "uniqued"):
+!2 = metadata !{metadata !2, metadata !0, metadata !"a scope in dom0"}
+!3 = metadata !{metadata !2}
+
+!4 = metadata !{metadata !4, metadata !0, metadata !"another scope in dom0"}
+!5 = metadata !{metadata !4}
+
+; A list of the two scopes.
+!6 = metadata !{metadata !2, metadata !4}
+
+; Another scope in the second domain
+!7 = metadata !{metadata !7, metadata !1, metadata !"another scope in dom1"}
+!8 = metadata !{metadata !7}
+
+; A list of scopes from both domains.
+!9 = metadata !{metadata !2, metadata !4, metadata !7}
+
+; CHECK: NoAlias: %0 = load float* %c, align 4, !alias.scope !0 <-> store float %0, float* %arrayidx.i, align 4, !noalias !6
+; CHECK: NoAlias: %0 = load float* %c, align 4, !alias.scope !0 <-> store float %1, float* %arrayidx.i2, align 4, !noalias !6
+; CHECK: MayAlias: %0 = load float* %c, align 4, !alias.scope !0 <-> store float %2, float* %arrayidx.i3, align 4, !noalias !7
+; CHECK: NoAlias: %1 = load float* %c, align 4, !alias.scope !7 <-> store float %0, float* %arrayidx.i, align 4, !noalias !6
+; CHECK: NoAlias: %1 = load float* %c, align 4, !alias.scope !7 <-> store float %1, float* %arrayidx.i2, align 4, !noalias !6
+; CHECK: NoAlias: %1 = load float* %c, align 4, !alias.scope !7 <-> store float %2, float* %arrayidx.i3, align 4, !noalias !7
+; CHECK: NoAlias: %2 = load float* %c, align 4, !alias.scope !6 <-> store float %0, float* %arrayidx.i, align 4, !noalias !6
+; CHECK: NoAlias: %2 = load float* %c, align 4, !alias.scope !6 <-> store float %1, float* %arrayidx.i2, align 4, !noalias !6
+; CHECK: MayAlias: %2 = load float* %c, align 4, !alias.scope !6 <-> store float %2, float* %arrayidx.i3, align 4, !noalias !7
+; CHECK: NoAlias: store float %1, float* %arrayidx.i2, align 4, !noalias !6 <-> store float %0, float* %arrayidx.i, align 4, !noalias !6
+; CHECK: NoAlias: store float %2, float* %arrayidx.i3, align 4, !noalias !7 <-> store float %0, float* %arrayidx.i, align 4, !noalias !6
+; CHECK: NoAlias: store float %2, float* %arrayidx.i3, align 4, !noalias !7 <-> store float %1, float* %arrayidx.i2, align 4, !noalias !6
+
diff --git a/test/Analysis/ScopedNoAliasAA/basic.ll b/test/Analysis/ScopedNoAliasAA/basic.ll
new file mode 100644
index 0000000..73fe333
--- /dev/null
+++ b/test/Analysis/ScopedNoAliasAA/basic.ll
@@ -0,0 +1,27 @@
+; RUN: opt < %s -basicaa -scoped-noalias -aa-eval -evaluate-aa-metadata -print-all-alias-modref-info -disable-output 2>&1 | 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-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @foo1(float* nocapture %a, float* nocapture readonly %c) #0 {
+entry:
+; CHECK-LABEL: Function: foo1
+ %0 = load float* %c, align 4, !alias.scope !1
+ %arrayidx.i = getelementptr inbounds float* %a, i64 5
+ store float %0, float* %arrayidx.i, align 4, !noalias !1
+ %1 = load float* %c, align 4
+ %arrayidx = getelementptr inbounds float* %a, i64 7
+ store float %1, float* %arrayidx, align 4
+ ret void
+
+; CHECK: NoAlias: %0 = load float* %c, align 4, !alias.scope !0 <-> store float %0, float* %arrayidx.i, align 4, !noalias !0
+; CHECK: MayAlias: %0 = load float* %c, align 4, !alias.scope !0 <-> store float %1, float* %arrayidx, align 4
+; CHECK: MayAlias: %1 = load float* %c, align 4 <-> store float %0, float* %arrayidx.i, align 4, !noalias !0
+; CHECK: MayAlias: %1 = load float* %c, align 4 <-> store float %1, float* %arrayidx, align 4
+; CHECK: NoAlias: store float %1, float* %arrayidx, align 4 <-> store float %0, float* %arrayidx.i, align 4, !noalias !0
+}
+
+attributes #0 = { nounwind uwtable }
+
+!0 = metadata !{metadata !0, metadata !"some domain"}
+!1 = metadata !{metadata !1, metadata !0, metadata !"some scope"}
+
diff --git a/test/Analysis/ScopedNoAliasAA/basic2.ll b/test/Analysis/ScopedNoAliasAA/basic2.ll
new file mode 100644
index 0000000..37b0add
--- /dev/null
+++ b/test/Analysis/ScopedNoAliasAA/basic2.ll
@@ -0,0 +1,41 @@
+; RUN: opt < %s -basicaa -scoped-noalias -aa-eval -evaluate-aa-metadata -print-all-alias-modref-info -disable-output 2>&1 | 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-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
+entry:
+; CHECK-LABEL: Function: foo2
+ %0 = load float* %c, align 4, !alias.scope !0
+ %arrayidx.i = getelementptr inbounds float* %a, i64 5
+ store float %0, float* %arrayidx.i, align 4, !alias.scope !5, !noalias !4
+ %arrayidx1.i = getelementptr inbounds float* %b, i64 8
+ store float %0, float* %arrayidx1.i, align 4, !alias.scope !0, !noalias !5
+ %1 = load float* %c, align 4
+ %arrayidx = getelementptr inbounds float* %a, i64 7
+ store float %1, float* %arrayidx, align 4
+ ret void
+
+; CHECK: MayAlias: %0 = load float* %c, align 4, !alias.scope !0 <-> store float %0, float* %arrayidx.i, align 4, !alias.scope !4, !noalia
+; CHECK: s !5
+; CHECK: MayAlias: %0 = load float* %c, align 4, !alias.scope !0 <-> store float %0, float* %arrayidx1.i, align 4, !alias.scope !0, !noali
+; CHECK: as !4
+; CHECK: MayAlias: %0 = load float* %c, align 4, !alias.scope !0 <-> store float %1, float* %arrayidx, align 4
+; CHECK: MayAlias: %1 = load float* %c, align 4 <-> store float %0, float* %arrayidx.i, align 4, !alias.scope !4, !noalias !5
+; CHECK: MayAlias: %1 = load float* %c, align 4 <-> store float %0, float* %arrayidx1.i, align 4, !alias.scope !0, !noalias !4
+; CHECK: MayAlias: %1 = load float* %c, align 4 <-> store float %1, float* %arrayidx, align 4
+; CHECK: NoAlias: store float %0, float* %arrayidx1.i, align 4, !alias.scope !0, !noalias !4 <-> store float %0, float* %arrayidx.i, align
+; CHECK: 4, !alias.scope !4, !noalias !5
+; CHECK: NoAlias: store float %1, float* %arrayidx, align 4 <-> store float %0, float* %arrayidx.i, align 4, !alias.scope !4, !noalias !5
+; CHECK: MayAlias: store float %1, float* %arrayidx, align 4 <-> store float %0, float* %arrayidx1.i, align 4, !alias.scope !0, !noalias !
+; CHECK: 4
+}
+
+attributes #0 = { nounwind uwtable }
+
+!0 = metadata !{metadata !1, metadata !3}
+!1 = metadata !{metadata !1, metadata !2, metadata !"some scope"}
+!2 = metadata !{metadata !2, metadata !"some domain"}
+!3 = metadata !{metadata !3, metadata !2, metadata !"some other scope"}
+!4 = metadata !{metadata !1}
+!5 = metadata !{metadata !3}
+
diff --git a/test/Analysis/TypeBasedAliasAnalysis/dse.ll b/test/Analysis/TypeBasedAliasAnalysis/dse.ll
index bcf1f2c..9032fad 100644
--- a/test/Analysis/TypeBasedAliasAnalysis/dse.ll
+++ b/test/Analysis/TypeBasedAliasAnalysis/dse.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -tbaa -basicaa -dse -S | FileCheck %s
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; DSE should make use of TBAA.
diff --git a/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll b/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll
index 609e87c..a027841 100644
--- a/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll
+++ b/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -tbaa -basicaa -aa-eval -evaluate-tbaa -print-no-aliases -print-may-aliases -disable-output 2>&1 | FileCheck %s
+; RUN: opt < %s -tbaa -basicaa -aa-eval -evaluate-aa-metadata -print-no-aliases -print-may-aliases -disable-output 2>&1 | FileCheck %s
; Generated with "clang -cc1 -disable-llvm-optzns -O1 -emit-llvm"
; #include <new>
diff --git a/test/Analysis/TypeBasedAliasAnalysis/tbaa-path.ll b/test/Analysis/TypeBasedAliasAnalysis/tbaa-path.ll
index e1c5d45..38bece7 100644
--- a/test/Analysis/TypeBasedAliasAnalysis/tbaa-path.ll
+++ b/test/Analysis/TypeBasedAliasAnalysis/tbaa-path.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -tbaa -basicaa -aa-eval -evaluate-tbaa -print-no-aliases -print-may-aliases -disable-output 2>&1 | FileCheck %s
+; RUN: opt < %s -tbaa -basicaa -aa-eval -evaluate-aa-metadata -print-no-aliases -print-may-aliases -disable-output 2>&1 | FileCheck %s
; RUN: opt < %s -tbaa -basicaa -gvn -S | FileCheck %s --check-prefix=OPT
; Generated from clang/test/CodeGen/tbaa.cpp with "-O1 -struct-path-tbaa -disable-llvm-optzns".