summaryrefslogtreecommitdiffstats
path: root/test/Analysis
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-02-20 12:57:14 +0000
committerdim <dim@FreeBSD.org>2011-02-20 12:57:14 +0000
commitcbb70ce070d220642b038ea101d9c0f9fbf860d6 (patch)
treed2b61ce94e654cb01a254d2195259db5f9cc3f3c /test/Analysis
parent4ace901e87dac5bbbac78ed325e75462e48e386e (diff)
downloadFreeBSD-src-cbb70ce070d220642b038ea101d9c0f9fbf860d6.zip
FreeBSD-src-cbb70ce070d220642b038ea101d9c0f9fbf860d6.tar.gz
Vendor import of llvm trunk r126079:
http://llvm.org/svn/llvm-project/llvm/trunk@126079
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll2
-rw-r--r--test/Analysis/BasicAA/2003-04-22-GEPProblem.ll2
-rw-r--r--test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll2
-rw-r--r--test/Analysis/BasicAA/2003-09-19-LocalArgument.ll2
-rw-r--r--test/Analysis/BasicAA/2003-11-04-SimpleCases.ll2
-rw-r--r--test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll2
-rw-r--r--test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll2
-rw-r--r--test/Analysis/BasicAA/2004-12-08-BasicAACrash.ll2
-rw-r--r--test/Analysis/BasicAA/2004-12-08-BasicAACrash2.ll2
-rw-r--r--test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll2
-rw-r--r--test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll2
-rw-r--r--test/Analysis/BasicAA/2007-11-05-SizeCrash.ll2
-rw-r--r--test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll2
-rw-r--r--test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll2
-rw-r--r--test/Analysis/BasicAA/2008-11-23-NoaliasRet.ll2
-rw-r--r--test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll2
-rw-r--r--test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll4
-rw-r--r--test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll15
-rw-r--r--test/Analysis/BasicAA/args-rets-allocas-loads.ll2
-rw-r--r--test/Analysis/BasicAA/byval.ll2
-rw-r--r--test/Analysis/BasicAA/constant-over-index.ll2
-rw-r--r--test/Analysis/BasicAA/empty.ll2
-rw-r--r--test/Analysis/BasicAA/full-store-partial-alias.ll33
-rw-r--r--test/Analysis/BasicAA/gep-alias.ll2
-rw-r--r--test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll2
-rw-r--r--test/Analysis/BasicAA/global-size.ll36
-rw-r--r--test/Analysis/BasicAA/modref.ll10
-rw-r--r--test/Analysis/BasicAA/phi-aa.ll2
-rw-r--r--test/Analysis/BasicAA/phi-and-select.ll2
-rw-r--r--test/Analysis/BasicAA/unreachable-block.ll2
-rw-r--r--test/Analysis/GlobalsModRef/aliastest.ll2
-rw-r--r--test/Analysis/GlobalsModRef/chaining-analysis.ll2
-rw-r--r--test/Analysis/GlobalsModRef/indirect-global.ll2
-rw-r--r--test/Analysis/GlobalsModRef/modreftest.ll2
-rw-r--r--test/Analysis/LoopDependenceAnalysis/alias.ll2
-rw-r--r--test/Analysis/LoopDependenceAnalysis/siv-strong.ll2
-rw-r--r--test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll2
-rw-r--r--test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll2
-rw-r--r--test/Analysis/LoopDependenceAnalysis/ziv.ll2
-rw-r--r--test/Analysis/PointerTracking/sizes.ll86
-rw-r--r--test/Analysis/Profiling/profiling-tool-chain.ll4
-rw-r--r--test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll24
-rw-r--r--test/Analysis/ScalarEvolution/fold.ll62
-rw-r--r--test/Analysis/ScalarEvolution/nsw.ll70
-rw-r--r--test/Analysis/ScalarEvolution/scev-aa.ll7
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/aliastest.ll62
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/argument-promotion.ll31
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/dg.exp (renamed from test/Analysis/PointerTracking/dg.exp)0
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/dse.ll66
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll81
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll91
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/licm.ll61
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll23
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/precedence.ll46
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/sink.ll20
55 files changed, 759 insertions, 141 deletions
diff --git a/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll b/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll
index 6b50a16..1c2d910 100644
--- a/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll
+++ b/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll
@@ -2,7 +2,7 @@
; is performed. It is not legal to delete the second load instruction because
; the value computed by the first load instruction is changed by the store.
-; RUN: opt < %s -gvn -instcombine -S | grep DONOTREMOVE
+; RUN: opt < %s -basicaa -gvn -instcombine -S | grep DONOTREMOVE
define i32 @test() {
%A = alloca i32
diff --git a/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll b/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll
index f7e8295..5d20077 100644
--- a/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll
+++ b/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -instcombine -S | grep sub
+; RUN: opt < %s -basicaa -gvn -instcombine -S | grep sub
; BasicAA was incorrectly concluding that P1 and P2 didn't conflict!
diff --git a/test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll b/test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll
index d439dfc..8ca3469 100644
--- a/test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll
+++ b/test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -licm -disable-output
+; RUN: opt < %s -basicaa -licm -disable-output
%struct..apr_array_header_t = type { i32*, i32, i32, i32, i8* }
%struct..apr_table_t = type { %struct..apr_array_header_t, i32, [32 x i32], [32 x i32] }
diff --git a/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll b/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll
index 637d8f0..56e3339 100644
--- a/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll
+++ b/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll
@@ -1,6 +1,6 @@
; In this test, a local alloca cannot alias an incoming argument.
-; RUN: opt < %s -gvn -instcombine -S | not grep sub
+; RUN: opt < %s -basicaa -gvn -instcombine -S | not grep sub
define i32 @test(i32* %P) {
%X = alloca i32
diff --git a/test/Analysis/BasicAA/2003-11-04-SimpleCases.ll b/test/Analysis/BasicAA/2003-11-04-SimpleCases.ll
index 911f78c..010a4588 100644
--- a/test/Analysis/BasicAA/2003-11-04-SimpleCases.ll
+++ b/test/Analysis/BasicAA/2003-11-04-SimpleCases.ll
@@ -1,7 +1,7 @@
; This testcase consists of alias relations which should be completely
; resolvable by basicaa.
-; RUN: opt < %s -aa-eval -print-may-aliases -disable-output \
+; RUN: opt < %s -basicaa -aa-eval -print-may-aliases -disable-output \
; RUN: |& not grep May:
%T = type { i32, [10 x i8] }
diff --git a/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll b/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll
index 8166b97..ce01db6 100644
--- a/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll
+++ b/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll
@@ -1,7 +1,7 @@
; This testcase consists of alias relations which should be completely
; resolvable by basicaa, but require analysis of getelementptr constant exprs.
-; RUN: opt < %s -aa-eval -print-may-aliases -disable-output \
+; RUN: opt < %s -basicaa -aa-eval -print-may-aliases -disable-output \
; RUN: |& not grep May:
%T = type { i32, [10 x i8] }
diff --git a/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll b/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll
index e1cfd03..56e4ed0 100644
--- a/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll
+++ b/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -dse -S | grep {store i32 0}
+; RUN: opt < %s -basicaa -dse -S | grep {store i32 0}
define void @test({i32,i32 }* %P) {
%Q = getelementptr {i32,i32}* %P, i32 1
diff --git a/test/Analysis/BasicAA/2004-12-08-BasicAACrash.ll b/test/Analysis/BasicAA/2004-12-08-BasicAACrash.ll
index 81248db..50fb222 100644
--- a/test/Analysis/BasicAA/2004-12-08-BasicAACrash.ll
+++ b/test/Analysis/BasicAA/2004-12-08-BasicAACrash.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -licm
+; RUN: opt < %s -basicaa -licm
%"java/lang/Object" = type { %struct.llvm_java_object_base }
%"java/lang/StringBuffer" = type { "java/lang/Object", i32, { "java/lang/Object", i32, [0 x i8] }*, i1 }
diff --git a/test/Analysis/BasicAA/2004-12-08-BasicAACrash2.ll b/test/Analysis/BasicAA/2004-12-08-BasicAACrash2.ll
index 0e03db3..cc84314 100644
--- a/test/Analysis/BasicAA/2004-12-08-BasicAACrash2.ll
+++ b/test/Analysis/BasicAA/2004-12-08-BasicAACrash2.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -dse
+; RUN: opt < %s -basicaa -dse
%"java/lang/Object" = type { %struct.llvm_java_object_base }
%"java/lang/StringBuffer" = type { "java/lang/Object", i32, { "java/lang/Object", i32, [0 x i8] }*, i1 }
diff --git a/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll b/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll
index 49327ac..8320594 100644
--- a/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll
+++ b/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -aa-eval -disable-output |& grep {2 no alias respon}
+; RUN: opt < %s -basicaa -aa-eval -disable-output |& grep {2 no alias respon}
; TEST that A[1][0] may alias A[0][i].
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
diff --git a/test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll b/test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll
index 85f53a6..0db5815 100644
--- a/test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll
+++ b/test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -licm -disable-output
+; RUN: opt < %s -basicaa -licm -disable-output
target datalayout = "E-p:32:32"
target triple = "powerpc-apple-darwin8.7.0"
diff --git a/test/Analysis/BasicAA/2007-11-05-SizeCrash.ll b/test/Analysis/BasicAA/2007-11-05-SizeCrash.ll
index f699ba2..563d332 100644
--- a/test/Analysis/BasicAA/2007-11-05-SizeCrash.ll
+++ b/test/Analysis/BasicAA/2007-11-05-SizeCrash.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -disable-output
+; RUN: opt < %s -basicaa -gvn -disable-output
; PR1774
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"
diff --git a/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll b/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll
index 8028afb..52d0af1 100644
--- a/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll
+++ b/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -disable-output
+; RUN: opt < %s -basicaa -gvn -disable-output
; PR1782
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"
diff --git a/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll b/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll
index ba29f3a..1709144 100644
--- a/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll
+++ b/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -disable-output
+; RUN: opt < %s -basicaa -gvn -disable-output
; PR2395
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:32:32"
diff --git a/test/Analysis/BasicAA/2008-11-23-NoaliasRet.ll b/test/Analysis/BasicAA/2008-11-23-NoaliasRet.ll
index 06018cc..c9e553d 100644
--- a/test/Analysis/BasicAA/2008-11-23-NoaliasRet.ll
+++ b/test/Analysis/BasicAA/2008-11-23-NoaliasRet.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -aa-eval |& grep {1 no alias response}
+; RUN: opt < %s -basicaa -aa-eval |& grep {1 no alias response}
declare noalias i32* @_Znwj(i32 %x) nounwind
diff --git a/test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll b/test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll
index 6475471..5078dd5 100644
--- a/test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll
+++ b/test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll
@@ -1,4 +1,4 @@
-; RUN: opt -gvn -instcombine -S < %s | FileCheck %s
+; RUN: opt -basicaa -gvn -instcombine -S < %s | FileCheck %s
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
declare i8 @llvm.atomic.load.add.i8.p0i8(i8*, i8)
diff --git a/test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll b/test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll
index 771636f..17db2fd 100644
--- a/test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll
+++ b/test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll
@@ -1,11 +1,11 @@
-; RUN: opt < %s -aa-eval -print-all-alias-modref-info -disable-output |& grep {NoAlias:.*%P,.*@Z}
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {NoAlias:.*%P,.*@Z}
; If GEP base doesn't alias Z, then GEP doesn't alias Z.
; rdar://7282591
@Y = common global i32 0
@Z = common global i32 0
-define void @foo(i32 %cond) nounwind ssp {
+define void @foo(i32 %cond) nounwind {
entry:
%a = alloca i32
%tmp = icmp ne i32 %cond, 0
diff --git a/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll b/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll
new file mode 100644
index 0000000..2b0cd78
--- /dev/null
+++ b/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll
@@ -0,0 +1,15 @@
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {1 may alias}
+; PR7959
+
+target datalayout = "e-p:32:32:32"
+
+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/BasicAA/args-rets-allocas-loads.ll b/test/Analysis/BasicAA/args-rets-allocas-loads.ll
index 7555a4c..c3c4afc 100644
--- a/test/Analysis/BasicAA/args-rets-allocas-loads.ll
+++ b/test/Analysis/BasicAA/args-rets-allocas-loads.ll
@@ -1,4 +1,4 @@
-; RUN: opt -aa-eval -print-all-alias-modref-info -disable-output < %s |& FileCheck %s
+; RUN: opt -basicaa -aa-eval -print-all-alias-modref-info -disable-output < %s |& FileCheck %s
declare void @callee(double* %callee_arg)
declare void @nocap_callee(double* nocapture %nocap_callee_arg)
diff --git a/test/Analysis/BasicAA/byval.ll b/test/Analysis/BasicAA/byval.ll
index cdcafdf..2aba753 100644
--- a/test/Analysis/BasicAA/byval.ll
+++ b/test/Analysis/BasicAA/byval.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | grep {ret i32 1}
+; RUN: opt < %s -basicaa -gvn -S | grep {ret i32 1}
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 = "i686-apple-darwin8"
%struct.x = type { i32, i32, i32, i32 }
diff --git a/test/Analysis/BasicAA/constant-over-index.ll b/test/Analysis/BasicAA/constant-over-index.ll
index 0e0c45c..8a8ac4f 100644
--- a/test/Analysis/BasicAA/constant-over-index.ll
+++ b/test/Analysis/BasicAA/constant-over-index.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -aa-eval -print-all-alias-modref-info |& FileCheck %s
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info |& FileCheck %s
; PR4267
; CHECK: MayAlias: double* %p.0.i.0, double* %p3
diff --git a/test/Analysis/BasicAA/empty.ll b/test/Analysis/BasicAA/empty.ll
index 689efec..7b06780 100644
--- a/test/Analysis/BasicAA/empty.ll
+++ b/test/Analysis/BasicAA/empty.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -aa-eval -print-all-alias-modref-info -disable-output \
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output \
; RUN: |& grep {NoAlias: \{\}\\* \[%\]p, \{\}\\* \[%\]q}
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"
diff --git a/test/Analysis/BasicAA/full-store-partial-alias.ll b/test/Analysis/BasicAA/full-store-partial-alias.ll
new file mode 100644
index 0000000..4fa6375
--- /dev/null
+++ b/test/Analysis/BasicAA/full-store-partial-alias.ll
@@ -0,0 +1,33 @@
+; RUN: opt -S -tbaa -basicaa -gvn < %s | grep {ret i32 %}
+; RUN: opt -S -tbaa -gvn < %s | grep {ret i32 0}
+; rdar://8875631, rdar://8875069
+
+; BasicAA should notice that the store stores to the entire %u object,
+; so the %tmp5 load is PartialAlias with the store and suppress TBAA.
+; Without BasicAA, 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 {
+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 !"double", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
+!3 = metadata !{metadata !"int", metadata !1}
diff --git a/test/Analysis/BasicAA/gep-alias.ll b/test/Analysis/BasicAA/gep-alias.ll
index eba9599..69f7faf 100644
--- a/test/Analysis/BasicAA/gep-alias.ll
+++ b/test/Analysis/BasicAA/gep-alias.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -instcombine -S |& FileCheck %s
+; RUN: opt < %s -basicaa -gvn -instcombine -S |& FileCheck %s
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"
diff --git a/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll b/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll
index 12b088b..062ea59 100644
--- a/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll
+++ b/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -aa-eval -print-all-alias-modref-info -disable-output |& FileCheck %s
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& FileCheck %s
; CHECK: Just Ref: call void @ro() <-> call void @f0()
diff --git a/test/Analysis/BasicAA/global-size.ll b/test/Analysis/BasicAA/global-size.ll
index b9cbbcc..a7e5aab 100644
--- a/test/Analysis/BasicAA/global-size.ll
+++ b/test/Analysis/BasicAA/global-size.ll
@@ -1,16 +1,40 @@
; A store or load cannot alias a global if the accessed amount is larger then
; the global.
-; RUN: opt < %s -basicaa -gvn -instcombine -S | not grep load
+; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
-@B = global i16 8 ; <i16*> [#uses=2]
+@B = global i16 8
-define i16 @test(i32* %P) {
- %X = load i16* @B ; <i16> [#uses=1]
+; CHECK: @test1
+define i16 @test1(i32* %P) {
+ %X = load i16* @B
store i32 7, i32* %P
- %Y = load i16* @B ; <i16> [#uses=1]
- %Z = sub i16 %Y, %X ; <i16> [#uses=1]
+ %Y = load i16* @B
+ %Z = sub i16 %Y, %X
ret i16 %Z
+; CHECK: ret i16 0
+}
+
+; Cannot know anything about the size of this global.
+; rdar://8813415
+@window = external global [0 x i8]
+
+; CHECK: @test2
+define i8 @test2(i32 %tmp79, i32 %w.2, i32 %indvar89) nounwind {
+ %tmp92 = add i32 %tmp79, %indvar89
+ %arrayidx412 = getelementptr [0 x i8]* @window, i32 0, i32 %tmp92
+ %tmp93 = add i32 %w.2, %indvar89
+ %arrayidx416 = getelementptr [0 x i8]* @window, i32 0, i32 %tmp93
+
+ %A = load i8* %arrayidx412, align 1
+ store i8 4, i8* %arrayidx416, align 1
+
+ %B = load i8* %arrayidx412, align 1
+ %C = sub i8 %A, %B
+ ret i8 %C
+
+; CHECK: %B = load i8
+; CHECK: ret i8 %C
}
diff --git a/test/Analysis/BasicAA/modref.ll b/test/Analysis/BasicAA/modref.ll
index b9a3c5e..ec0c8a7 100644
--- a/test/Analysis/BasicAA/modref.ll
+++ b/test/Analysis/BasicAA/modref.ll
@@ -85,11 +85,11 @@ define void @test3a(i8* %P, i8 %X) {
%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 ;; FIXME: Killed by llvm.lifetime.end, should be zapped.
-; CHECK: store i8 %Y, i8* %P2
+ store i8 %Y, i8* %P2
+; CHECK-NEXT: call void @llvm.lifetime.end
call void @llvm.lifetime.end(i64 10, i8* %P)
ret void
-; CHECK: ret void
+; CHECK-NEXT: ret void
}
@G1 = external global i32
@@ -105,7 +105,7 @@ define i32 @test4(i8* %P) {
; CHECK: load i32* @G
; CHECK: memset.p0i8.i32
; CHECK-NOT: load
-; CHECK: sub i32 %tmp, %tmp
+; CHECK: ret i32 0
}
; Verify that basicaa is handling variable length memcpy, knowing it doesn't
@@ -120,7 +120,7 @@ define i32 @test5(i8* %P, i32 %Len) {
; CHECK: load i32* @G
; CHECK: memcpy.p0i8.p0i8.i32
; CHECK-NOT: load
-; CHECK: sub i32 %tmp, %tmp
+; CHECK: ret i32 0
}
define i8 @test6(i8* %p, i8* noalias %a) {
diff --git a/test/Analysis/BasicAA/phi-aa.ll b/test/Analysis/BasicAA/phi-aa.ll
index 0288960..50fd5cd 100644
--- a/test/Analysis/BasicAA/phi-aa.ll
+++ b/test/Analysis/BasicAA/phi-aa.ll
@@ -5,7 +5,7 @@
@Y = common global i32 0
@Z = common global i32 0
-define void @foo(i32 %cond) nounwind ssp {
+define void @foo(i32 %cond) nounwind {
entry:
%"alloca point" = bitcast i32 0 to i32
%tmp = icmp ne i32 %cond, 0
diff --git a/test/Analysis/BasicAA/phi-and-select.ll b/test/Analysis/BasicAA/phi-and-select.ll
index c69e824..9bc47ae 100644
--- a/test/Analysis/BasicAA/phi-and-select.ll
+++ b/test/Analysis/BasicAA/phi-and-select.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -aa-eval -print-all-alias-modref-info -disable-output \
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output \
; RUN: |& grep {NoAlias: double\\* \[%\]a, double\\* \[%\]b\$} | count 4
; BasicAA should detect NoAliases in PHIs and Selects.
diff --git a/test/Analysis/BasicAA/unreachable-block.ll b/test/Analysis/BasicAA/unreachable-block.ll
index 3382188..1ca1e66 100644
--- a/test/Analysis/BasicAA/unreachable-block.ll
+++ b/test/Analysis/BasicAA/unreachable-block.ll
@@ -1,4 +1,4 @@
-; RUN: opt -aa-eval -disable-output < %s >& /dev/null
+; RUN: opt -basicaa -aa-eval -disable-output < %s >& /dev/null
; BasicAA shouldn't infinitely recurse on the use-def cycles in
; unreachable code.
diff --git a/test/Analysis/GlobalsModRef/aliastest.ll b/test/Analysis/GlobalsModRef/aliastest.ll
index 3e5d119..75af4dc 100644
--- a/test/Analysis/GlobalsModRef/aliastest.ll
+++ b/test/Analysis/GlobalsModRef/aliastest.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -globalsmodref-aa -gvn -S | not grep load
+; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -S | not grep load
@X = internal global i32 4 ; <i32*> [#uses=1]
define i32 @test(i32* %P) {
diff --git a/test/Analysis/GlobalsModRef/chaining-analysis.ll b/test/Analysis/GlobalsModRef/chaining-analysis.ll
index b1d4593..431b2a6 100644
--- a/test/Analysis/GlobalsModRef/chaining-analysis.ll
+++ b/test/Analysis/GlobalsModRef/chaining-analysis.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -globalsmodref-aa -gvn -S | not grep load
+; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -S | not grep load
; This test requires the use of previous analyses to determine that
; doesnotmodX does not modify X (because 'sin' doesn't).
diff --git a/test/Analysis/GlobalsModRef/indirect-global.ll b/test/Analysis/GlobalsModRef/indirect-global.ll
index 4074909..1eab0bc 100644
--- a/test/Analysis/GlobalsModRef/indirect-global.ll
+++ b/test/Analysis/GlobalsModRef/indirect-global.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -globalsmodref-aa -gvn -instcombine -S | \
+; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -instcombine -S | \
; RUN: grep {ret i32 0}
@G = internal global i32* null ; <i32**> [#uses=3]
diff --git a/test/Analysis/GlobalsModRef/modreftest.ll b/test/Analysis/GlobalsModRef/modreftest.ll
index 257c0ee..3a02a94a 100644
--- a/test/Analysis/GlobalsModRef/modreftest.ll
+++ b/test/Analysis/GlobalsModRef/modreftest.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -globalsmodref-aa -gvn -S | not grep load
+; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -S | not grep load
@X = internal global i32 4 ; <i32*> [#uses=2]
define i32 @test(i32* %P) {
diff --git a/test/Analysis/LoopDependenceAnalysis/alias.ll b/test/Analysis/LoopDependenceAnalysis/alias.ll
index 97be3fd..78d0bf4 100644
--- a/test/Analysis/LoopDependenceAnalysis/alias.ll
+++ b/test/Analysis/LoopDependenceAnalysis/alias.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -analyze -lda | FileCheck %s
+; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
;; x[5] = x[6] // with x being a pointer passed as argument
diff --git a/test/Analysis/LoopDependenceAnalysis/siv-strong.ll b/test/Analysis/LoopDependenceAnalysis/siv-strong.ll
index 36ac153..401e466 100644
--- a/test/Analysis/LoopDependenceAnalysis/siv-strong.ll
+++ b/test/Analysis/LoopDependenceAnalysis/siv-strong.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -analyze -lda | FileCheck %s
+; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
@x = common global [256 x i32] zeroinitializer, align 4
@y = common global [256 x i32] zeroinitializer, align 4
diff --git a/test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll b/test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll
index a7f9bda..9d0128c 100644
--- a/test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll
+++ b/test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -analyze -lda | FileCheck %s
+; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
@x = common global [256 x i32] zeroinitializer, align 4
@y = common global [256 x i32] zeroinitializer, align 4
diff --git a/test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll b/test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll
index e75aefd..1c5ae4c 100644
--- a/test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll
+++ b/test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -analyze -lda | FileCheck %s
+; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
@x = common global [256 x i32] zeroinitializer, align 4
@y = common global [256 x i32] zeroinitializer, align 4
diff --git a/test/Analysis/LoopDependenceAnalysis/ziv.ll b/test/Analysis/LoopDependenceAnalysis/ziv.ll
index ba45948..645ae7f 100644
--- a/test/Analysis/LoopDependenceAnalysis/ziv.ll
+++ b/test/Analysis/LoopDependenceAnalysis/ziv.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -analyze -lda | FileCheck %s
+; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
@x = common global [256 x i32] zeroinitializer, align 4
diff --git a/test/Analysis/PointerTracking/sizes.ll b/test/Analysis/PointerTracking/sizes.ll
deleted file mode 100644
index c8ca648..0000000
--- a/test/Analysis/PointerTracking/sizes.ll
+++ /dev/null
@@ -1,86 +0,0 @@
-; RUN: opt < %s -pointertracking -analyze | 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"
-target triple = "x86_64-unknown-linux-gnu"
-@.str = internal constant [5 x i8] c"1234\00" ; <[5 x i8]*> [#uses=1]
-@test1p = global i8* getelementptr ([5 x i8]* @.str, i32 0, i32 0), align 8 ; <i8**> [#uses=1]
-@test1a = global [5 x i8] c"1234\00", align 1 ; <[5 x i8]*> [#uses=1]
-@test2a = global [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5], align 4 ; <[5 x i32]*> [#uses=2]
-@test2p = global i32* getelementptr ([5 x i32]* @test2a, i32 0, i32 0), align 8 ; <i32**> [#uses=1]
-@test0p = common global i32* null, align 8 ; <i32**> [#uses=1]
-@test0i = common global i32 0, align 4 ; <i32*> [#uses=1]
-
-define i32 @foo0() nounwind {
-entry:
- %tmp = load i32** @test0p ; <i32*> [#uses=1]
- %conv = bitcast i32* %tmp to i8* ; <i8*> [#uses=1]
- %call = tail call i32 @bar(i8* %conv) nounwind ; <i32> [#uses=1]
- %tmp1 = load i8** @test1p ; <i8*> [#uses=1]
- %call2 = tail call i32 @bar(i8* %tmp1) nounwind ; <i32> [#uses=1]
- %call3 = tail call i32 @bar(i8* getelementptr ([5 x i8]* @test1a, i32 0, i32 0)) nounwind ; <i32> [#uses=1]
- %call5 = tail call i32 @bar(i8* bitcast ([5 x i32]* @test2a to i8*)) nounwind ; <i32> [#uses=1]
- %tmp7 = load i32** @test2p ; <i32*> [#uses=1]
- %conv8 = bitcast i32* %tmp7 to i8* ; <i8*> [#uses=1]
- %call9 = tail call i32 @bar(i8* %conv8) nounwind ; <i32> [#uses=1]
- %call11 = tail call i32 @bar(i8* bitcast (i32* @test0i to i8*)) nounwind ; <i32> [#uses=1]
- %add = add i32 %call2, %call ; <i32> [#uses=1]
- %add4 = add i32 %add, %call3 ; <i32> [#uses=1]
- %add6 = add i32 %add4, %call5 ; <i32> [#uses=1]
- %add10 = add i32 %add6, %call9 ; <i32> [#uses=1]
- %add12 = add i32 %add10, %call11 ; <i32> [#uses=1]
- ret i32 %add12
-}
-
-declare i32 @bar(i8*)
-
-define i32 @foo1(i32 %n) nounwind {
-entry:
-; CHECK: 'foo1':
- %test4a = alloca [10 x i8], align 1 ; <[10 x i8]*> [#uses=1]
-; CHECK: %test4a =
-; CHECK: ==> 1 elements, 10 bytes allocated
- %test6a = alloca [10 x i32], align 4 ; <[10 x i32]*> [#uses=1]
-; CHECK: %test6a =
-; CHECK: ==> 1 elements, 40 bytes allocated
- %vla = alloca i8, i32 %n, align 1 ; <i8*> [#uses=1]
-; CHECK: %vla =
-; CHECK: ==> %n elements, %n bytes allocated
- %0 = shl i32 %n, 2 ; <i32> [#uses=1]
- %vla7 = alloca i8, i32 %0, align 1 ; <i8*> [#uses=1]
-; CHECK: %vla7 =
-; CHECK: ==> (4 * %n) elements, (4 * %n) bytes allocated
- %call = call i32 @bar(i8* %vla) nounwind ; <i32> [#uses=1]
- %arraydecay = getelementptr [10 x i8]* %test4a, i64 0, i64 0 ; <i8*> [#uses=1]
- %call10 = call i32 @bar(i8* %arraydecay) nounwind ; <i32> [#uses=1]
- %call11 = call i32 @bar(i8* %vla7) nounwind ; <i32> [#uses=1]
- %ptrconv14 = bitcast [10 x i32]* %test6a to i8* ; <i8*> [#uses=1]
- %call15 = call i32 @bar(i8* %ptrconv14) nounwind ; <i32> [#uses=1]
- %add = add i32 %call10, %call ; <i32> [#uses=1]
- %add12 = add i32 %add, %call11 ; <i32> [#uses=1]
- %add16 = add i32 %add12, %call15 ; <i32> [#uses=1]
- ret i32 %add16
-}
-
-define i32 @foo2(i64 %n) nounwind {
-entry:
- %call = tail call i8* @malloc(i64 %n) ; <i8*> [#uses=1]
-; CHECK: %call =
-; CHECK: ==> %n elements, %n bytes allocated
- %call2 = tail call i8* @calloc(i64 2, i64 4) nounwind ; <i8*> [#uses=1]
-; CHECK: %call2 =
-; CHECK: ==> 8 elements, 8 bytes allocated
- %call4 = tail call i8* @realloc(i8* null, i64 16) nounwind ; <i8*> [#uses=1]
-; CHECK: %call4 =
-; CHECK: ==> 16 elements, 16 bytes allocated
- %call6 = tail call i32 @bar(i8* %call) nounwind ; <i32> [#uses=1]
- %call8 = tail call i32 @bar(i8* %call2) nounwind ; <i32> [#uses=1]
- %call10 = tail call i32 @bar(i8* %call4) nounwind ; <i32> [#uses=1]
- %add = add i32 %call8, %call6 ; <i32> [#uses=1]
- %add11 = add i32 %add, %call10 ; <i32> [#uses=1]
- ret i32 %add11
-}
-
-declare noalias i8* @malloc(i64) nounwind
-
-declare noalias i8* @calloc(i64, i64) nounwind
-
-declare noalias i8* @realloc(i8* nocapture, i64) nounwind
diff --git a/test/Analysis/Profiling/profiling-tool-chain.ll b/test/Analysis/Profiling/profiling-tool-chain.ll
index 5ac31b5..9135a85 100644
--- a/test/Analysis/Profiling/profiling-tool-chain.ll
+++ b/test/Analysis/Profiling/profiling-tool-chain.ll
@@ -9,8 +9,8 @@
; Test the creation, reading and displaying of profile
; RUX: rm -f llvmprof.out
-; RUX: lli -load %llvmlibsdir/profile_rt%shlibext %t2
-; RUX: lli -load %llvmlibsdir/profile_rt%shlibext %t2 1 2
+; RUX: lli -load %llvmshlibdir/profile_rt%shlibext %t2
+; RUX: lli -load %llvmshlibdir/profile_rt%shlibext %t2 1 2
; RUX: llvm-prof -print-all-code %t1 | FileCheck --check-prefix=PROF %s
; Test the loaded profile also with verifier.
diff --git a/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll b/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll
new file mode 100644
index 0000000..aba0ce7
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll
@@ -0,0 +1,24 @@
+; RUN: opt -indvars -scalar-evolution -analyze %s
+; This test checks if the SCEV analysis is printed out at all.
+; It failed once as the RequiredTransitive option was not implemented
+; correctly.
+
+define i32 @main() nounwind {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %indvar1 = phi i64 [ %indvar.next2, %for.inc ], [ 0, %entry ] ; <i64> [#uses=3]
+ %exitcond = icmp ne i64 %indvar1, 1024 ; <i1> [#uses=1]
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %indvar.next2 = add i64 %indvar1, 1 ; <i64> [#uses=1]
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret i32 0
+}
diff --git a/test/Analysis/ScalarEvolution/fold.ll b/test/Analysis/ScalarEvolution/fold.ll
new file mode 100644
index 0000000..4e2adf1
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/fold.ll
@@ -0,0 +1,62 @@
+; RUN: opt -analyze -scalar-evolution %s -S | FileCheck %s
+
+define i16 @test1(i8 %x) {
+ %A = zext i8 %x to i12
+ %B = sext i12 %A to i16
+; CHECK: zext i8 %x to i16
+ ret i16 %B
+}
+
+define i8 @test2(i8 %x) {
+ %A = zext i8 %x to i16
+ %B = add i16 %A, 1025
+ %C = trunc i16 %B to i8
+; CHECK: (1 + %x)
+ ret i8 %C
+}
+
+define i8 @test3(i8 %x) {
+ %A = zext i8 %x to i16
+ %B = mul i16 %A, 1027
+ %C = trunc i16 %B to i8
+; CHECK: (3 * %x)
+ ret i8 %C
+}
+
+define void @test4(i32 %x, i32 %y) {
+entry:
+ %Y = and i32 %y, 3
+ br label %loop
+loop:
+ %A = phi i32 [0, %entry], [%I, %loop]
+ %rand1 = icmp sgt i32 %A, %Y
+ %Z1 = select i1 %rand1, i32 %A, i32 %Y
+ %rand2 = icmp ugt i32 %A, %Z1
+ %Z2 = select i1 %rand2, i32 %A, i32 %Z1
+; CHECK: %Z2 =
+; CHECK-NEXT: --> ([[EXPR:.*]]){{ +}}Exits: 20
+ %B = trunc i32 %Z2 to i16
+ %C = sext i16 %B to i30
+; CHECK: %C =
+; CHECK-NEXT: (trunc i32 ([[EXPR]]) to i30)
+ %D = sext i16 %B to i32
+; CHECK: %D =
+; CHECK-NEXT: ([[EXPR]])
+ %E = sext i16 %B to i34
+; CHECK: %E =
+; CHECK-NEXT: (zext i32 ([[EXPR]]) to i34)
+ %F = zext i16 %B to i30
+; CHECK: %F =
+; CHECK-NEXT: (trunc i32 ([[EXPR]]) to i30
+ %G = zext i16 %B to i32
+; CHECK: %G =
+; CHECK-NEXT: ([[EXPR]])
+ %H = zext i16 %B to i34
+; CHECK: %H =
+; CHECK-NEXT: (zext i32 ([[EXPR]]) to i34)
+ %I = add i32 %A, 1
+ %0 = icmp ne i32 %A, 20
+ br i1 %0, label %loop, label %exit
+exit:
+ ret void
+}
diff --git a/test/Analysis/ScalarEvolution/nsw.ll b/test/Analysis/ScalarEvolution/nsw.ll
index 456f3f0..9d8e2b6 100644
--- a/test/Analysis/ScalarEvolution/nsw.ll
+++ b/test/Analysis/ScalarEvolution/nsw.ll
@@ -1,10 +1,11 @@
-; RUN: opt < %s -analyze -scalar-evolution | grep { --> {.*,+,.*}<%bb>} | count 8
+; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
; The addrecs in this loop are analyzable only by using nsw information.
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64"
-define void @foo(double* %p) nounwind {
+; CHECK: Classifying expressions for: @test1
+define void @test1(double* %p) nounwind {
entry:
%tmp = load double* %p, align 8 ; <double> [#uses=1]
%tmp1 = fcmp ogt double %tmp, 2.000000e+00 ; <i1> [#uses=1]
@@ -15,19 +16,29 @@ bb.nph: ; preds = %entry
bb: ; preds = %bb1, %bb.nph
%i.01 = phi i32 [ %tmp8, %bb1 ], [ 0, %bb.nph ] ; <i32> [#uses=3]
+; CHECK: %i.01
+; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%bb>
%tmp2 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
%tmp3 = getelementptr double* %p, i64 %tmp2 ; <double*> [#uses=1]
%tmp4 = load double* %tmp3, align 8 ; <double> [#uses=1]
%tmp5 = fmul double %tmp4, 9.200000e+00 ; <double> [#uses=1]
%tmp6 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
%tmp7 = getelementptr double* %p, i64 %tmp6 ; <double*> [#uses=1]
+; CHECK: %tmp7
+; CHECK-NEXT: --> {%p,+,8}<%bb>
store double %tmp5, double* %tmp7, align 8
%tmp8 = add nsw i32 %i.01, 1 ; <i32> [#uses=2]
+; CHECK: %tmp8
+; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%bb>
br label %bb1
bb1: ; preds = %bb
%phitmp = sext i32 %tmp8 to i64 ; <i64> [#uses=1]
+; CHECK: %phitmp
+; CHECK-NEXT: --> {1,+,1}<%bb>
%tmp9 = getelementptr double* %p, i64 %phitmp ; <double*> [#uses=1]
+; CHECK: %tmp9
+; CHECK-NEXT: --> {(8 + %p),+,8}<%bb>
%tmp10 = load double* %tmp9, align 8 ; <double> [#uses=1]
%tmp11 = fcmp ogt double %tmp10, 2.000000e+00 ; <i1> [#uses=1]
br i1 %tmp11, label %bb, label %bb1.return_crit_edge
@@ -38,3 +49,58 @@ bb1.return_crit_edge: ; preds = %bb1
return: ; preds = %bb1.return_crit_edge, %entry
ret void
}
+
+; CHECK: Classifying expressions for: @test2
+define void @test2(i32* %begin, i32* %end) ssp {
+entry:
+ %cmp1.i.i = icmp eq i32* %begin, %end
+ br i1 %cmp1.i.i, label %_ZSt4fillIPiiEvT_S1_RKT0_.exit, label %for.body.lr.ph.i.i
+
+for.body.lr.ph.i.i: ; preds = %entry
+ br label %for.body.i.i
+
+for.body.i.i: ; preds = %for.body.i.i, %for.body.lr.ph.i.i
+ %__first.addr.02.i.i = phi i32* [ %begin, %for.body.lr.ph.i.i ], [ %ptrincdec.i.i, %for.body.i.i ]
+; CHECK: %__first.addr.02.i.i
+; CHECK-NEXT: --> {%begin,+,4}<nsw><%for.body.i.i>
+ store i32 0, i32* %__first.addr.02.i.i, align 4
+ %ptrincdec.i.i = getelementptr inbounds i32* %__first.addr.02.i.i, i64 1
+; CHECK: %ptrincdec.i.i
+; CHECK-NEXT: --> {(4 + %begin),+,4}<nsw><%for.body.i.i>
+ %cmp.i.i = icmp eq i32* %ptrincdec.i.i, %end
+ br i1 %cmp.i.i, label %for.cond.for.end_crit_edge.i.i, label %for.body.i.i
+
+for.cond.for.end_crit_edge.i.i: ; preds = %for.body.i.i
+ br label %_ZSt4fillIPiiEvT_S1_RKT0_.exit
+
+_ZSt4fillIPiiEvT_S1_RKT0_.exit: ; preds = %entry, %for.cond.for.end_crit_edge.i.i
+ ret void
+}
+
+; Various checks for inbounds geps.
+define void @test3(i32* %begin, i32* %end) nounwind ssp {
+entry:
+ %cmp7.i.i = icmp eq i32* %begin, %end
+ br i1 %cmp7.i.i, label %_ZSt4fillIPiiEvT_S1_RKT0_.exit, label %for.body.i.i
+
+for.body.i.i: ; preds = %entry, %for.body.i.i
+ %indvar.i.i = phi i64 [ %tmp, %for.body.i.i ], [ 0, %entry ]
+; CHECK: %indvar.i.i
+; CHECK: {0,+,1}<nuw><nsw><%for.body.i.i>
+ %tmp = add nsw i64 %indvar.i.i, 1
+; CHECK: %tmp =
+; CHECK: {1,+,1}<nuw><nsw><%for.body.i.i>
+ %ptrincdec.i.i = getelementptr inbounds i32* %begin, i64 %tmp
+; CHECK: %ptrincdec.i.i =
+; CHECK: {(4 + %begin),+,4}<nsw><%for.body.i.i>
+ %__first.addr.08.i.i = getelementptr inbounds i32* %begin, i64 %indvar.i.i
+; CHECK: %__first.addr.08.i.i
+; CHECK: {%begin,+,4}<nsw><%for.body.i.i>
+ store i32 0, i32* %__first.addr.08.i.i, align 4
+ %cmp.i.i = icmp eq i32* %ptrincdec.i.i, %end
+ br i1 %cmp.i.i, label %_ZSt4fillIPiiEvT_S1_RKT0_.exit, label %for.body.i.i
+; CHECK: Loop %for.body.i.i: Unpredictable backedge-taken count.
+; CHECK: Loop %for.body.i.i: Unpredictable max backedge-taken count.
+_ZSt4fillIPiiEvT_S1_RKT0_.exit: ; preds = %for.body.i.i, %entry
+ ret void
+} \ No newline at end of file
diff --git a/test/Analysis/ScalarEvolution/scev-aa.ll b/test/Analysis/ScalarEvolution/scev-aa.ll
index 866664a..dd5a66c 100644
--- a/test/Analysis/ScalarEvolution/scev-aa.ll
+++ b/test/Analysis/ScalarEvolution/scev-aa.ll
@@ -190,9 +190,8 @@ define void @bar() {
ret void
}
-; TODO: This is theoretically provable to be NoAlias.
; CHECK: Function: nonnegative: 2 pointers, 0 call sites
-; CHECK: MayAlias: i64* %arrayidx, i64* %p
+; CHECK: NoAlias: i64* %arrayidx, i64* %p
define void @nonnegative(i64* %p) nounwind {
entry:
@@ -211,6 +210,6 @@ for.end: ; preds = %for.body, %entry
ret void
}
-; CHECK: 13 no alias responses
-; CHECK: 27 may alias responses
+; CHECK: 14 no alias responses
+; CHECK: 26 may alias responses
; CHECK: 18 must alias responses
diff --git a/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll b/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll
new file mode 100644
index 0000000..d59e392
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll
@@ -0,0 +1,62 @@
+; RUN: opt < %s -tbaa -basicaa -gvn -S | FileCheck %s
+
+; Test that basic alias queries work.
+
+; CHECK: @test0_yes
+; CHECK: add i8 %x, %x
+define i8 @test0_yes(i8* %a, i8* %b) nounwind {
+ %x = load i8* %a, !tbaa !1
+ store i8 0, i8* %b, !tbaa !2
+ %y = load i8* %a, !tbaa !1
+ %z = add i8 %x, %y
+ ret i8 %z
+}
+
+; CHECK: @test0_no
+; CHECK: add i8 %x, %y
+define i8 @test0_no(i8* %a, i8* %b) nounwind {
+ %x = load i8* %a, !tbaa !3
+ store i8 0, i8* %b, !tbaa !4
+ %y = load i8* %a, !tbaa !3
+ %z = add i8 %x, %y
+ ret i8 %z
+}
+
+; Test that basic invariant-memory queries work.
+
+; CHECK: @test1_yes
+; CHECK: add i8 %x, %x
+define i8 @test1_yes(i8* %a, i8* %b) nounwind {
+ %x = load i8* %a, !tbaa !5
+ store i8 0, i8* %b
+ %y = load i8* %a, !tbaa !5
+ %z = add i8 %x, %y
+ ret i8 %z
+}
+
+; CHECK: @test1_no
+; CHECK: add i8 %x, %y
+define i8 @test1_no(i8* %a, i8* %b) nounwind {
+ %x = load i8* %a, !tbaa !6
+ store i8 0, i8* %b
+ %y = load i8* %a, !tbaa !6
+ %z = add i8 %x, %y
+ ret i8 %z
+}
+
+; Root note.
+!0 = metadata !{ }
+; Some type.
+!1 = metadata !{ metadata !"foo", metadata !0 }
+; Some other non-aliasing type.
+!2 = metadata !{ metadata !"bar", metadata !0 }
+
+; Some type.
+!3 = metadata !{ metadata !"foo", metadata !0 }
+; Some type in a different type system.
+!4 = metadata !{ metadata !"bar", metadata !"different" }
+
+; Invariant memory.
+!5 = metadata !{ metadata !"qux", metadata !0, i1 1 }
+; Not invariant memory.
+!6 = metadata !{ metadata !"qux", metadata !0, i1 0 }
diff --git a/test/Analysis/TypeBasedAliasAnalysis/argument-promotion.ll b/test/Analysis/TypeBasedAliasAnalysis/argument-promotion.ll
new file mode 100644
index 0000000..3b5211e
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/argument-promotion.ll
@@ -0,0 +1,31 @@
+; RUN: opt < %s -tbaa -basicaa -argpromotion -mem2reg -S | not grep alloca
+
+target datalayout = "E-p:64:64:64"
+
+define internal i32 @test(i32* %X, i32* %Y, i32* %Q) {
+ store i32 77, i32* %Q, !tbaa !2
+ %A = load i32* %X, !tbaa !1
+ %B = load i32* %Y, !tbaa !1
+ %C = add i32 %A, %B
+ ret i32 %C
+}
+
+define internal i32 @caller(i32* %B, i32* %Q) {
+ %A = alloca i32
+ store i32 78, i32* %Q, !tbaa !2
+ store i32 1, i32* %A, !tbaa !1
+ %C = call i32 @test(i32* %A, i32* %B, i32* %Q)
+ ret i32 %C
+}
+
+define i32 @callercaller(i32* %Q) {
+ %B = alloca i32
+ store i32 2, i32* %B, !tbaa !1
+ store i32 79, i32* %Q, !tbaa !2
+ %X = call i32 @caller(i32* %B, i32* %Q)
+ ret i32 %X
+}
+
+!0 = metadata !{metadata !"test"}
+!1 = metadata !{metadata !"green", metadata !0}
+!2 = metadata !{metadata !"blue", metadata !0}
diff --git a/test/Analysis/PointerTracking/dg.exp b/test/Analysis/TypeBasedAliasAnalysis/dg.exp
index f200589..f200589 100644
--- a/test/Analysis/PointerTracking/dg.exp
+++ b/test/Analysis/TypeBasedAliasAnalysis/dg.exp
diff --git a/test/Analysis/TypeBasedAliasAnalysis/dse.ll b/test/Analysis/TypeBasedAliasAnalysis/dse.ll
new file mode 100644
index 0000000..6b44eb6
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/dse.ll
@@ -0,0 +1,66 @@
+; RUN: opt < %s -tbaa -basicaa -dse -S | FileCheck %s
+
+; DSE should make use of TBAA.
+
+; CHECK: @test0_yes
+; CHECK-NEXT: load i8* %b
+; CHECK-NEXT: store i8 1, i8* %a
+; CHECK-NEXT: ret i8 %y
+define i8 @test0_yes(i8* %a, i8* %b) nounwind {
+ store i8 0, i8* %a, !tbaa !1
+ %y = load i8* %b, !tbaa !2
+ store i8 1, i8* %a, !tbaa !1
+ ret i8 %y
+}
+
+; CHECK: @test0_no
+; CHECK-NEXT: store i8 0, i8* %a
+; CHECK-NEXT: load i8* %b
+; CHECK-NEXT: store i8 1, i8* %a
+; CHECK-NEXT: ret i8 %y
+define i8 @test0_no(i8* %a, i8* %b) nounwind {
+ store i8 0, i8* %a, !tbaa !3
+ %y = load i8* %b, !tbaa !4
+ store i8 1, i8* %a, !tbaa !3
+ ret i8 %y
+}
+
+; CHECK: @test1_yes
+; CHECK-NEXT: load i8* %b
+; CHECK-NEXT: store i8 1, i8* %a
+; CHECK-NEXT: ret i8 %y
+define i8 @test1_yes(i8* %a, i8* %b) nounwind {
+ store i8 0, i8* %a
+ %y = load i8* %b, !tbaa !5
+ store i8 1, i8* %a
+ ret i8 %y
+}
+
+; CHECK: @test1_no
+; CHECK-NEXT: store i8 0, i8* %a
+; CHECK-NEXT: load i8* %b
+; CHECK-NEXT: store i8 1, i8* %a
+; CHECK-NEXT: ret i8 %y
+define i8 @test1_no(i8* %a, i8* %b) nounwind {
+ store i8 0, i8* %a
+ %y = load i8* %b, !tbaa !6
+ store i8 1, i8* %a
+ ret i8 %y
+}
+
+; Root note.
+!0 = metadata !{ }
+; Some type.
+!1 = metadata !{ metadata !"foo", metadata !0 }
+; Some other non-aliasing type.
+!2 = metadata !{ metadata !"bar", metadata !0 }
+
+; Some type.
+!3 = metadata !{ metadata !"foo", metadata !0 }
+; Some type in a different type system.
+!4 = metadata !{ metadata !"bar", metadata !"different" }
+
+; Invariant memory.
+!5 = metadata !{ metadata !"qux", metadata !0, i1 1 }
+; Not invariant memory.
+!6 = metadata !{ metadata !"qux", metadata !0, i1 0 }
diff --git a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
new file mode 100644
index 0000000..8fb5fff
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
@@ -0,0 +1,81 @@
+; RUN: opt < %s -tbaa -basicaa -functionattrs -S | FileCheck %s
+
+; FunctionAttrs should make use of TBAA.
+
+; Add the readnone attribute, since the only access is a store which TBAA
+; says is to constant memory.
+;
+; It's unusual to see a store to constant memory, but it isn't necessarily
+; invalid, as it's possible that this only happens after optimization on a
+; code path which isn't ever executed.
+
+; CHECK: define void @test0_yes(i32* nocapture %p) nounwind readnone {
+define void @test0_yes(i32* %p) nounwind {
+ store i32 0, i32* %p, !tbaa !1
+ ret void
+}
+
+; CHECK: define void @test0_no(i32* nocapture %p) nounwind {
+define void @test0_no(i32* %p) nounwind {
+ store i32 0, i32* %p, !tbaa !2
+ ret void
+}
+
+; Add the readonly attribute, since there's just a call to a function which
+; TBAA says doesn't modify any memory.
+
+; CHECK: define void @test1_yes(i32* %p) nounwind readonly {
+define void @test1_yes(i32* %p) nounwind {
+ call void @callee(i32* %p), !tbaa !1
+ ret void
+}
+
+; CHECK: define void @test1_no(i32* %p) nounwind {
+define void @test1_no(i32* %p) nounwind {
+ call void @callee(i32* %p), !tbaa !2
+ ret void
+}
+
+; Add the readonly attribute, as above, but this time BasicAA will say
+; that the function accesses memory through its arguments, which TBAA
+; still says that the function doesn't write to memory.
+;
+; This is unusual, since the function is memcpy, but as above, this
+; isn't necessarily invalid.
+
+; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind readnone {
+define void @test2_yes(i8* %p, i8* %q, i64 %n) nounwind {
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !1
+ ret void
+}
+
+; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind {
+define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind {
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !2
+ ret void
+}
+
+; Similar to the others, va_arg only accesses memory through its operand.
+
+; CHECK: define i32 @test3_yes(i8* nocapture %p) nounwind readnone {
+define i32 @test3_yes(i8* %p) nounwind {
+ %t = va_arg i8* %p, i32, !tbaa !1
+ ret i32 %t
+}
+
+; CHECK: define i32 @test3_no(i8* nocapture %p) nounwind {
+define i32 @test3_no(i8* %p) nounwind {
+ %t = va_arg i8* %p, i32, !tbaa !2
+ ret i32 %t
+}
+
+declare void @callee(i32* %p) nounwind
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i32, i1) nounwind
+
+; Root note.
+!0 = metadata !{ }
+
+; Invariant memory.
+!1 = metadata !{ metadata !"foo", metadata !0, i1 1 }
+; Not invariant memory.
+!2 = metadata !{ metadata !"foo", metadata !0, i1 0 }
diff --git a/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll b/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll
new file mode 100644
index 0000000..eceaa2c
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll
@@ -0,0 +1,91 @@
+; RUN: opt -tbaa -basicaa -gvn -S < %s | FileCheck %s
+
+target datalayout = "e-p:64:64:64"
+
+; GVN should ignore the store to p1 to see that the load from p is
+; fully redundant.
+
+; CHECK: @yes
+; CHECK: if.then:
+; CHECK-NEXT: store i32 0, i32* %q
+; CHECK-NEXT: ret void
+
+define void @yes(i1 %c, i32* %p, i32* %p1, i32* %q) nounwind {
+entry:
+ store i32 0, i32* %p, !tbaa !1
+ store i32 1, i32* %p1, !tbaa !2
+ br i1 %c, label %if.else, label %if.then
+
+if.then:
+ %t = load i32* %p, !tbaa !1
+ store i32 %t, i32* %q
+ ret void
+
+if.else:
+ ret void
+}
+
+; GVN should ignore the store to p1 to see that the first load from p is
+; fully redundant. However, the second load uses a different type. Theoretically
+; the other type could be unified with the first type, however for now, GVN
+; should just be conservative.
+
+; CHECK: @watch_out_for_type_change
+; CHECK: if.then:
+; CHECK: %t = load i32* %p
+; CHECK: store i32 %t, i32* %q
+; CHECK: ret void
+; CHECK: if.else:
+; CHECK: %u = load i32* %p
+; CHECK: store i32 %u, i32* %q
+
+define void @watch_out_for_type_change(i1 %c, i32* %p, i32* %p1, i32* %q) nounwind {
+entry:
+ store i32 0, i32* %p, !tbaa !1
+ store i32 1, i32* %p1, !tbaa !2
+ br i1 %c, label %if.else, label %if.then
+
+if.then:
+ %t = load i32* %p, !tbaa !4
+ store i32 %t, i32* %q
+ ret void
+
+if.else:
+ %u = load i32* %p, !tbaa !3
+ store i32 %u, i32* %q
+ ret void
+}
+
+; As before, but the types are swapped. This time GVN does managed to
+; eliminate one of the loads before noticing the type mismatch.
+
+; CHECK: @watch_out_for_another_type_change
+; CHECK: if.then:
+; CHECK: %t = load i32* %p
+; CHECK: store i32 %t, i32* %q
+; CHECK: ret void
+; CHECK: if.else:
+; CHECK: store i32 0, i32* %q
+
+define void @watch_out_for_another_type_change(i1 %c, i32* %p, i32* %p1, i32* %q) nounwind {
+entry:
+ store i32 0, i32* %p, !tbaa !1
+ store i32 1, i32* %p1, !tbaa !2
+ br i1 %c, label %if.else, label %if.then
+
+if.then:
+ %t = load i32* %p, !tbaa !3
+ store i32 %t, i32* %q
+ ret void
+
+if.else:
+ %u = load i32* %p, !tbaa !4
+ store i32 %u, i32* %q
+ ret void
+}
+
+!0 = metadata !{}
+!1 = metadata !{metadata !"red", metadata !0}
+!2 = metadata !{metadata !"blu", metadata !0}
+!3 = metadata !{metadata !"outer space"}
+!4 = metadata !{metadata !"brick red", metadata !1}
diff --git a/test/Analysis/TypeBasedAliasAnalysis/licm.ll b/test/Analysis/TypeBasedAliasAnalysis/licm.ll
new file mode 100644
index 0000000..12a9c1d
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/licm.ll
@@ -0,0 +1,61 @@
+; RUN: opt -tbaa -licm -S < %s | FileCheck %s
+
+; LICM should be able to hoist the address load out of the loop
+; by using TBAA information.
+
+; CHECK: @foo
+; CHECK: entry:
+; CHECK-NEXT: %tmp3 = load double** @P, !tbaa !0
+; CHECK-NEXT: br label %for.body
+
+@P = common global double* null
+
+define void @foo(i64 %n) nounwind {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %i.07 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+ %tmp3 = load double** @P, !tbaa !1
+ %scevgep = getelementptr double* %tmp3, i64 %i.07
+ %tmp4 = load double* %scevgep, !tbaa !2
+ %mul = fmul double %tmp4, 2.300000e+00
+ store double %mul, double* %scevgep, !tbaa !2
+ %inc = add i64 %i.07, 1
+ %exitcond = icmp eq i64 %inc, %n
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
+
+!0 = metadata !{metadata !"root", null}
+!1 = metadata !{metadata !"pointer", metadata !0}
+!2 = metadata !{metadata !"double", metadata !0}
+
+; LICM shouldn't hoist anything here.
+
+; CHECK: @bar
+; CHECK: loop:
+; CHECK: load
+; CHECK: store
+; CHECK: load
+; CHECK: store
+; CHECK: br label %loop
+
+define void @bar(i8** %p) nounwind {
+entry:
+ %q = bitcast i8** %p to i8*
+ br label %loop
+
+loop:
+ %tmp51 = load i8** %p, !tbaa !4
+ store i8* %tmp51, i8** %p
+ %tmp40 = load i8* %q, !tbaa !5
+ store i8 %tmp40, i8* %q
+ br label %loop
+}
+
+!3 = metadata !{metadata !"pointer", metadata !4}
+!4 = metadata !{metadata !"char", metadata !5}
+!5 = metadata !{metadata !"root", null}
diff --git a/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll b/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll
new file mode 100644
index 0000000..c2407df
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll
@@ -0,0 +1,23 @@
+; RUN: opt -S -tbaa -basicaa -memcpyopt -instcombine < %s | FileCheck %s
+
+target datalayout = "e-p:64:64:64"
+
+; The second memcpy is redundant and can be deleted. There's an intervening store, but
+; it has a TBAA tag which declares that it is unrelated.
+
+; CHECK: @foo
+; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 16, i32 1, i1 false), !tbaa !0
+; CHECK-NEXT: store i8 2, i8* %s, align 1, !tbaa !2
+; CHECK-NEXT: ret void
+define void @foo(i8* nocapture %p, i8* nocapture %q, i8* nocapture %s) nounwind {
+ tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 16, i32 1, i1 false), !tbaa !2
+ store i8 2, i8* %s, align 1, !tbaa !1
+ tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %q, i8* %p, i64 16, i32 1, i1 false), !tbaa !2
+ ret void
+}
+
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
+
+!0 = metadata !{metadata !"tbaa root", null}
+!1 = metadata !{metadata !"A", metadata !0}
+!2 = metadata !{metadata !"B", metadata !0}
diff --git a/test/Analysis/TypeBasedAliasAnalysis/precedence.ll b/test/Analysis/TypeBasedAliasAnalysis/precedence.ll
new file mode 100644
index 0000000..47cb5f2
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/precedence.ll
@@ -0,0 +1,46 @@
+; RUN: opt -basicaa -tbaa -gvn -instcombine -S < %s | FileCheck %s --check-prefix=TBAA
+; RUN: opt -tbaa -basicaa -gvn -instcombine -S < %s | FileCheck %s --check-prefix=BASICAA
+
+; According to the TBAA metadata the load and store don't alias. However,
+; according to the actual code, they do. The order of the alias analysis
+; passes should determine which of these takes precedence.
+
+target datalayout = "e-p:64:64:64"
+
+; Test for simple MustAlias aliasing.
+
+; TBAA: @trouble
+; TBAA: ret i32 0
+; BASICAA: @trouble
+; BASICAA: ret i32 1075000115
+define i32 @trouble(i32* %x) nounwind {
+entry:
+ store i32 0, i32* %x, !tbaa !0
+ %0 = bitcast i32* %x to float*
+ store float 0x4002666660000000, float* %0, !tbaa !3
+ %tmp3 = load i32* %x, !tbaa !0
+ ret i32 %tmp3
+}
+
+; Test for PartialAlias aliasing. GVN doesn't yet eliminate the load
+; in the BasicAA case.
+
+; TBAA: @offset
+; TBAA: ret i64 0
+; BASICAA: @offset
+; BASICAA: ret i64 %tmp3
+define i64 @offset(i64* %x) nounwind {
+entry:
+ store i64 0, i64* %x, !tbaa !4
+ %0 = bitcast i64* %x to i8*
+ %1 = getelementptr i8* %0, i64 1
+ store i8 1, i8* %1, !tbaa !5
+ %tmp3 = load i64* %x, !tbaa !4
+ ret i64 %tmp3
+}
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"simple"}
+!3 = metadata !{metadata !"float", metadata !1}
+!4 = metadata !{metadata !"long", metadata !1}
+!5 = metadata !{metadata !"small", metadata !1}
diff --git a/test/Analysis/TypeBasedAliasAnalysis/sink.ll b/test/Analysis/TypeBasedAliasAnalysis/sink.ll
new file mode 100644
index 0000000..fd32d6a
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/sink.ll
@@ -0,0 +1,20 @@
+; RUN: opt -tbaa -sink -S < %s | FileCheck %s
+
+; CHECK: a:
+; CHECK: %f = load float* %p, !tbaa !2
+; CHECK: store float %f, float* %q
+
+define void @foo(float* %p, i1 %c, float* %q, float* %r) {
+ %f = load float* %p, !tbaa !0
+ store float 0.0, float* %r, !tbaa !1
+ br i1 %c, label %a, label %b
+a:
+ store float %f, float* %q
+ br label %b
+b:
+ ret void
+}
+
+!0 = metadata !{metadata !"A", metadata !2}
+!1 = metadata !{metadata !"B", metadata !2}
+!2 = metadata !{metadata !"test"}
OpenPOWER on IntegriCloud