diff options
author | dim <dim@FreeBSD.org> | 2012-08-15 19:34:23 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-08-15 19:34:23 +0000 |
commit | 721c201bd55ffb73cb2ba8d39e0570fa38c44e15 (patch) | |
tree | eacfc83d988e4b9d11114387ae7dc41243f2a363 /test/Analysis/BasicAA | |
parent | 2b2816e083a455f7a656ae88b0fd059d1688bb36 (diff) | |
download | FreeBSD-src-721c201bd55ffb73cb2ba8d39e0570fa38c44e15.zip FreeBSD-src-721c201bd55ffb73cb2ba8d39e0570fa38c44e15.tar.gz |
Vendor import of llvm trunk r161861:
http://llvm.org/svn/llvm-project/llvm/trunk@161861
Diffstat (limited to 'test/Analysis/BasicAA')
34 files changed, 165 insertions, 88 deletions
diff --git a/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll b/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll index 1c2d910..45f6088 100644 --- a/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll +++ b/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll @@ -2,17 +2,19 @@ ; 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 -basicaa -gvn -instcombine -S | grep DONOTREMOVE +; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s define i32 @test() { - %A = alloca i32 - store i32 0, i32* %A - %X = load i32* %A - %B = bitcast i32* %A to i8* - %C = getelementptr i8* %B, i64 1 - store i8 1, i8* %C ; Aliases %A - %Y.DONOTREMOVE = load i32* %A - %Z = sub i32 %X, %Y.DONOTREMOVE - ret i32 %Z +; CHECK: %Y.DONOTREMOVE = load i32* %A +; CHECK: %Z = sub i32 0, %Y.DONOTREMOVE + %A = alloca i32 + store i32 0, i32* %A + %X = load i32* %A + %B = bitcast i32* %A to i8* + %C = getelementptr i8* %B, i64 1 + store i8 1, i8* %C ; Aliases %A + %Y.DONOTREMOVE = load i32* %A + %Z = sub i32 %X, %Y.DONOTREMOVE + ret i32 %Z } diff --git a/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll b/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll index 5d20077..78f74a0 100644 --- a/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll +++ b/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll @@ -1,15 +1,14 @@ -; RUN: opt < %s -basicaa -gvn -instcombine -S | grep sub +; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s ; BasicAA was incorrectly concluding that P1 and P2 didn't conflict! define i32 @test(i32 *%Ptr, i64 %V) { - %P2 = getelementptr i32* %Ptr, i64 1 - %P1 = getelementptr i32* %Ptr, i64 %V - %X = load i32* %P1 - store i32 5, i32* %P2 - - %Y = load i32* %P1 - - %Z = sub i32 %X, %Y - ret i32 %Z +; CHECK: sub i32 %X, %Y + %P2 = getelementptr i32* %Ptr, i64 1 + %P1 = getelementptr i32* %Ptr, i64 %V + %X = load i32* %P1 + store i32 5, i32* %P2 + %Y = load i32* %P1 + %Z = sub i32 %X, %Y + ret i32 %Z } diff --git a/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll b/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll index 56e3339..fd4c239 100644 --- a/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll +++ b/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll @@ -1,6 +1,9 @@ ; In this test, a local alloca cannot alias an incoming argument. -; RUN: opt < %s -basicaa -gvn -instcombine -S | not grep sub +; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s + +; CHECK: define i32 @test +; CHECK-NEXT: ret i32 0 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 010a4588..768411e 100644 --- a/test/Analysis/BasicAA/2003-11-04-SimpleCases.ll +++ b/test/Analysis/BasicAA/2003-11-04-SimpleCases.ll @@ -1,11 +1,13 @@ ; This testcase consists of alias relations which should be completely ; resolvable by basicaa. -; RUN: opt < %s -basicaa -aa-eval -print-may-aliases -disable-output \ -; RUN: |& not grep May: +; RUN: opt < %s -basicaa -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 diff --git a/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll b/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll index ce01db6..b7bbf77 100644 --- a/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll +++ b/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll @@ -1,13 +1,15 @@ ; This testcase consists of alias relations which should be completely ; resolvable by basicaa, but require analysis of getelementptr constant exprs. -; RUN: opt < %s -basicaa -aa-eval -print-may-aliases -disable-output \ -; RUN: |& not grep May: +; RUN: opt < %s -basicaa -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 diff --git a/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll b/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll index 56e4ed0..578aa594 100644 --- a/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll +++ b/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll @@ -1,10 +1,11 @@ -; RUN: opt < %s -basicaa -dse -S | grep {store i32 0} +; RUN: opt < %s -basicaa -dse -S | FileCheck %s define void @test({i32,i32 }* %P) { - %Q = getelementptr {i32,i32}* %P, i32 1 - %X = getelementptr {i32,i32}* %Q, i32 0, i32 1 - %Y = getelementptr {i32,i32}* %Q, i32 1, i32 1 - store i32 0, i32* %X - store i32 1, i32* %Y - ret void +; CHECK: store i32 0, i32* %X + %Q = getelementptr {i32,i32}* %P, i32 1 + %X = getelementptr {i32,i32}* %Q, i32 0, i32 1 + %Y = getelementptr {i32,i32}* %Q, i32 1, i32 1 + store i32 0, i32* %X + store i32 1, i32* %Y + ret void } diff --git a/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll b/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll index 8320594..06a804c 100644 --- a/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll +++ b/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll @@ -1,7 +1,9 @@ -; RUN: opt < %s -basicaa -aa-eval -disable-output |& grep {2 no alias respon} +; RUN: opt < %s -basicaa -aa-eval -disable-output 2>&1 | FileCheck %s ; 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" +; CHECK: 2 no alias responses + define void @test(i32 %N) { entry: %X = alloca [3 x [3 x i32]] ; <[3 x [3 x i32]]*> [#uses=4] diff --git a/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll b/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll index 917bf25..46b6aaf 100644 --- a/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll +++ b/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll @@ -1,9 +1,5 @@ +; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s ; PR1109 -; RUN: opt < %s -basicaa -gvn -instcombine -S | \ -; RUN: grep {sub i32} -; RUN: opt < %s -basicaa -gvn -instcombine -S | \ -; RUN: not grep {ret i32 0} -; END. target datalayout = "e-p:32:32" target triple = "i686-apple-darwin8" @@ -20,6 +16,9 @@ target triple = "i686-apple-darwin8" %struct.head_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, %struct.rec*, { %struct.rec* }, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, i32 } %struct.rec = type { %struct.head_type } +; CHECK: define i32 @test +; CHECK: %Z = sub i32 %A, %Q +; CHECK: ret i32 %Z define i32 @test(%struct.closure_type* %tmp18169) { %tmp18174 = getelementptr %struct.closure_type* %tmp18169, i32 0, i32 4, i32 0, i32 0 ; <i32*> [#uses=2] diff --git a/test/Analysis/BasicAA/2007-08-01-NoAliasAndCalls.ll b/test/Analysis/BasicAA/2007-08-01-NoAliasAndCalls.ll index e6a26e3..2a6f5b9 100644 --- a/test/Analysis/BasicAA/2007-08-01-NoAliasAndCalls.ll +++ b/test/Analysis/BasicAA/2007-08-01-NoAliasAndCalls.ll @@ -1,6 +1,7 @@ -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {MayAlias:.*i32\\* %., i32\\* %.} | grep {%x} | grep {%y} +; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s -declare i32* @unclear(i32* %a) +; CHECK: Function: foo +; CHECK: MayAlias: i32* %x, i32* %y define void @foo(i32* noalias %x) { %y = call i32* @unclear(i32* %x) @@ -8,3 +9,5 @@ define void @foo(i32* noalias %x) { store i32 0, i32* %y ret void } + +declare i32* @unclear(i32* %a) diff --git a/test/Analysis/BasicAA/2007-08-01-NoAliasAndGEP.ll b/test/Analysis/BasicAA/2007-08-01-NoAliasAndGEP.ll index 7f33fa4..4be793e 100644 --- a/test/Analysis/BasicAA/2007-08-01-NoAliasAndGEP.ll +++ b/test/Analysis/BasicAA/2007-08-01-NoAliasAndGEP.ll @@ -1,6 +1,9 @@ -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {9 no alias} -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {6 may alias} -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {MayAlias:.*i32\\* %Ipointer, i32\\* %Jpointer} +; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s + +; CHECK: Function: foo +; CHECK: MayAlias: i32* %Ipointer, i32* %Jpointer +; CHECK: 9 no alias responses +; CHECK: 6 may alias responses define void @foo(i32* noalias %p, i32* noalias %q, i32 %i, i32 %j) { %Ipointer = getelementptr i32* %p, i32 %i diff --git a/test/Analysis/BasicAA/2007-08-05-GetOverloadedModRef.ll b/test/Analysis/BasicAA/2007-08-05-GetOverloadedModRef.ll index 5b81c17..ec0e2bd 100644 --- a/test/Analysis/BasicAA/2007-08-05-GetOverloadedModRef.ll +++ b/test/Analysis/BasicAA/2007-08-05-GetOverloadedModRef.ll @@ -1,11 +1,10 @@ +; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s ; PR1600 -; RUN: opt < %s -basicaa -gvn -instcombine -S | \ -; RUN: grep {ret i32 0} -; END. declare i16 @llvm.cttz.i16(i16, i1) define i32 @test(i32* %P, i16* %Q) { +; CHECK: ret i32 0 %A = load i16* %Q ; <i16> [#uses=1] %x = load i32* %P ; <i32> [#uses=1] %B = call i16 @llvm.cttz.i16( i16 %A, i1 true ) ; <i16> [#uses=1] diff --git a/test/Analysis/BasicAA/2007-10-24-ArgumentsGlobals.ll b/test/Analysis/BasicAA/2007-10-24-ArgumentsGlobals.ll index 78f24b5..429160e 100644 --- a/test/Analysis/BasicAA/2007-10-24-ArgumentsGlobals.ll +++ b/test/Analysis/BasicAA/2007-10-24-ArgumentsGlobals.ll @@ -1,10 +1,12 @@ -; RUN: opt < %s -basicaa -gvn -dce -S | grep tmp7 +; RUN: opt < %s -basicaa -gvn -dce -S | FileCheck %s %struct.A = type { i32 } %struct.B = type { %struct.A } @a = global %struct.B zeroinitializer ; <%struct.B*> [#uses=2] define i32 @_Z3fooP1A(%struct.A* %b) { +; CHECK: %tmp7 = load +; CHECK: ret i32 %tmp7 entry: store i32 1, i32* getelementptr (%struct.B* @a, i32 0, i32 0, i32 0), align 8 %tmp4 = getelementptr %struct.A* %b, i32 0, i32 0 ;<i32*> [#uses=1] diff --git a/test/Analysis/BasicAA/2008-04-15-Byval.ll b/test/Analysis/BasicAA/2008-04-15-Byval.ll index 2069401..428189a 100644 --- a/test/Analysis/BasicAA/2008-04-15-Byval.ll +++ b/test/Analysis/BasicAA/2008-04-15-Byval.ll @@ -1,10 +1,11 @@ -; RUN: opt < %s -std-compile-opts -S | grep store +; RUN: opt < %s -std-compile-opts -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" %struct.x = type { [4 x i32] } define void @foo(%struct.x* byval align 4 %X) nounwind { +; CHECK: store i32 2, i32* %tmp1 entry: %tmp = getelementptr %struct.x* %X, i32 0, i32 0 ; <[4 x i32]*> [#uses=1] %tmp1 = getelementptr [4 x i32]* %tmp, i32 0, i32 3 ; <i32*> [#uses=1] diff --git a/test/Analysis/BasicAA/2008-11-23-NoaliasRet.ll b/test/Analysis/BasicAA/2008-11-23-NoaliasRet.ll index c9e553d..3db9a3f 100644 --- a/test/Analysis/BasicAA/2008-11-23-NoaliasRet.ll +++ b/test/Analysis/BasicAA/2008-11-23-NoaliasRet.ll @@ -1,7 +1,9 @@ -; RUN: opt < %s -basicaa -aa-eval |& grep {1 no alias response} +; RUN: opt < %s -basicaa -aa-eval -disable-output 2>&1 | FileCheck %s declare noalias i32* @_Znwj(i32 %x) nounwind +; CHECK: 1 no alias response + define i32 @foo() { %A = call i32* @_Znwj(i32 4) %B = call i32* @_Znwj(i32 4) diff --git a/test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll b/test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll index 3ab5d03..add7dee 100644 --- a/test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll +++ b/test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll @@ -1,8 +1,9 @@ -; RUN: opt < %s -basicaa -gvn -S | grep load +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s declare noalias i32* @noalias() define i32 @test(i32 %x) { +; CHECK: load i32* %a %a = call i32* @noalias() store i32 1, i32* %a %b = getelementptr i32* %a, i32 %x diff --git a/test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll b/test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll index 17db2fd..c546d68 100644 --- a/test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll +++ b/test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll @@ -1,10 +1,13 @@ -; RUN: opt < %s -basicaa -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 2>&1 | FileCheck %s ; 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 +; CHECK: Function: foo +; CHECK: NoAlias: i32* %P, i32* @Z + define void @foo(i32 %cond) nounwind { entry: %a = alloca i32 diff --git a/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll b/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll index 7b5584e..6656980 100644 --- a/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll +++ b/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll @@ -1,8 +1,10 @@ -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {1 partial alias} +; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s ; PR7959 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 diff --git a/test/Analysis/BasicAA/args-rets-allocas-loads.ll b/test/Analysis/BasicAA/args-rets-allocas-loads.ll index c7b43ec..066f46b 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 -basicaa -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 2>&1 | 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 2aba753..673fee0 100644 --- a/test/Analysis/BasicAA/byval.ll +++ b/test/Analysis/BasicAA/byval.ll @@ -1,17 +1,17 @@ -; RUN: opt < %s -basicaa -gvn -S | grep {ret i32 1} +; RUN: opt < %s -basicaa -gvn -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" target triple = "i686-apple-darwin8" %struct.x = type { i32, i32, i32, i32 } @g = weak global i32 0 ; <i32*> [#uses=1] define i32 @foo(%struct.x* byval %a) nounwind { -entry: - %tmp1 = tail call i32 (...)* @bar( %struct.x* %a ) nounwind ; <i32> [#uses=0] - %tmp2 = getelementptr %struct.x* %a, i32 0, i32 0 ; <i32*> [#uses=2] - store i32 1, i32* %tmp2, align 4 - store i32 2, i32* @g, align 4 - %tmp4 = load i32* %tmp2, align 4 ; <i32> [#uses=1] - ret i32 %tmp4 +; CHECK: ret i32 1 + %tmp1 = tail call i32 (...)* @bar( %struct.x* %a ) nounwind ; <i32> [#uses=0] + %tmp2 = getelementptr %struct.x* %a, i32 0, i32 0 ; <i32*> [#uses=2] + store i32 1, i32* %tmp2, align 4 + store i32 2, i32* @g, align 4 + %tmp4 = load i32* %tmp2, align 4 ; <i32> [#uses=1] + ret i32 %tmp4 } declare i32 @bar(...) diff --git a/test/Analysis/BasicAA/cas.ll b/test/Analysis/BasicAA/cas.ll index 754309c..d0cd9f4 100644 --- a/test/Analysis/BasicAA/cas.ll +++ b/test/Analysis/BasicAA/cas.ll @@ -1,8 +1,9 @@ -; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i32 0} +; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s @flag0 = internal global i32 zeroinitializer @turn = internal global i32 zeroinitializer +; CHECK: ret i32 0 define i32 @main() { %a = load i32* @flag0 diff --git a/test/Analysis/BasicAA/constant-over-index.ll b/test/Analysis/BasicAA/constant-over-index.ll index 48ef259..232533c 100644 --- a/test/Analysis/BasicAA/constant-over-index.ll +++ b/test/Analysis/BasicAA/constant-over-index.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info |& FileCheck %s +; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s ; PR4267 ; CHECK: MayAlias: double* %p.0.i.0, double* %p3 diff --git a/test/Analysis/BasicAA/dag.ll b/test/Analysis/BasicAA/dag.ll index 501f4c3..1d2f6f1 100644 --- a/test/Analysis/BasicAA/dag.ll +++ b/test/Analysis/BasicAA/dag.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info |& FileCheck %s +; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info 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" diff --git a/test/Analysis/BasicAA/empty.ll b/test/Analysis/BasicAA/empty.ll index 7b06780..dfc79f9 100644 --- a/test/Analysis/BasicAA/empty.ll +++ b/test/Analysis/BasicAA/empty.ll @@ -1,8 +1,10 @@ -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output \ -; RUN: |& grep {NoAlias: \{\}\\* \[%\]p, \{\}\\* \[%\]q} +; 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" +; CHECK: Function: foo: +; CHECK-NEXT: NoAlias: {}* %p, {}* %q + define void @foo({}* %p, {}* %q) { store {} {}, {}* %p store {} {}, {}* %q diff --git a/test/Analysis/BasicAA/full-store-partial-alias.ll b/test/Analysis/BasicAA/full-store-partial-alias.ll index 4fa6375..2c34fd5 100644 --- a/test/Analysis/BasicAA/full-store-partial-alias.ll +++ b/test/Analysis/BasicAA/full-store-partial-alias.ll @@ -1,5 +1,5 @@ -; RUN: opt -S -tbaa -basicaa -gvn < %s | grep {ret i32 %} -; RUN: opt -S -tbaa -gvn < %s | grep {ret i32 0} +; RUN: opt -S -tbaa -basicaa -gvn < %s | FileCheck -check-prefix=BASICAA %s +; RUN: opt -S -tbaa -gvn < %s | FileCheck %s ; rdar://8875631, rdar://8875069 ; BasicAA should notice that the store stores to the entire %u object, @@ -14,6 +14,8 @@ target datalayout = "e-p:64:64:64" @endianness_test = global i64 1, align 8 define i32 @signbit(double %x) nounwind { +; BASICAA: 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 diff --git a/test/Analysis/BasicAA/gcsetest.ll b/test/Analysis/BasicAA/gcsetest.ll index a903362..db557b7 100644 --- a/test/Analysis/BasicAA/gcsetest.ll +++ b/test/Analysis/BasicAA/gcsetest.ll @@ -2,12 +2,15 @@ ; disambiguating some obvious cases. All loads should be removable in ; this testcase. -; RUN: opt < %s -basicaa -gvn -instcombine -dce -S \ -; RUN: | not grep load +; RUN: opt < %s -basicaa -gvn -instcombine -dce -S | FileCheck %s @A = global i32 7 @B = global i32 8 +; CHECK: define i32 @test() +; CHECK-NEXT: store i32 123, i32* @B +; CHECK-NEXT: ret i32 0 + define i32 @test() { %A1 = load i32* @A @@ -18,6 +21,14 @@ define i32 @test() { ret i32 %X } +; CHECK: define i32 @test2() +; CHECK-NEXT: br label %Loop +; CHECK: Loop: +; CHECK-NEXT: store i32 0, i32* @B +; CHECK-NEXT: br i1 true, label %out, label %Loop +; CHECK: out: +; CHECK-NEXT: ret i32 0 + define i32 @test2() { %A1 = load i32* @A br label %Loop @@ -36,6 +47,10 @@ out: declare void @external() +; CHECK: define i32 @test3() +; CHECK-NEXT: call void @external() +; CHECK-NEXT: ret i32 7 + define i32 @test3() { %X = alloca i32 store i32 7, i32* %X diff --git a/test/Analysis/BasicAA/gep-alias.ll b/test/Analysis/BasicAA/gep-alias.ll index 4bb2832..9c2c7ee 100644 --- a/test/Analysis/BasicAA/gep-alias.ll +++ b/test/Analysis/BasicAA/gep-alias.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -instcombine -S |& FileCheck %s +; RUN: opt < %s -basicaa -gvn -instcombine -S 2>&1 | 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 ebd349a..f0f1a63 100644 --- a/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll +++ b/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& FileCheck %s +; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s ; CHECK: Just Ref: call void @ro() <-> call void @f0() diff --git a/test/Analysis/BasicAA/must-and-partial.ll b/test/Analysis/BasicAA/must-and-partial.ll index 93b6184..58139ff 100644 --- a/test/Analysis/BasicAA/must-and-partial.ll +++ b/test/Analysis/BasicAA/must-and-partial.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info |& FileCheck %s +; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s ; When merging MustAlias and PartialAlias, merge to PartialAlias ; instead of MayAlias. diff --git a/test/Analysis/BasicAA/no-escape-call.ll b/test/Analysis/BasicAA/no-escape-call.ll index ccabce9..b93db6e 100644 --- a/test/Analysis/BasicAA/no-escape-call.ll +++ b/test/Analysis/BasicAA/no-escape-call.ll @@ -1,9 +1,10 @@ -; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i1 true} +; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s ; PR2436 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" define i1 @foo(i32 %i) nounwind { +; CHECK: ret i1 true entry: %arr = alloca [10 x i8*] ; <[10 x i8*]*> [#uses=1] %tmp2 = call i8* @getPtr( ) nounwind ; <i8*> [#uses=2] diff --git a/test/Analysis/BasicAA/nocapture.ll b/test/Analysis/BasicAA/nocapture.ll index 7970fbb..a8658ec 100644 --- a/test/Analysis/BasicAA/nocapture.ll +++ b/test/Analysis/BasicAA/nocapture.ll @@ -1,8 +1,9 @@ -; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i32 0} +; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s declare i32* @test(i32* nocapture) define i32 @test2() { +; CHECK: ret i32 0 %P = alloca i32 %Q = call i32* @test(i32* %P) %a = load i32* %P diff --git a/test/Analysis/BasicAA/phi-aa.ll b/test/Analysis/BasicAA/phi-aa.ll index 50fd5cd..6aa26c1 100644 --- a/test/Analysis/BasicAA/phi-aa.ll +++ b/test/Analysis/BasicAA/phi-aa.ll @@ -1,10 +1,12 @@ -; RUN: opt < %s -basicaa -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 2>&1 | FileCheck %s ; rdar://7282591 @X = common global i32 0 @Y = common global i32 0 @Z = common global i32 0 +; CHECK: NoAlias: i32* %P, i32* @Z + define void @foo(i32 %cond) nounwind { entry: %"alloca point" = bitcast i32 0 to i32 diff --git a/test/Analysis/BasicAA/phi-and-select.ll b/test/Analysis/BasicAA/phi-and-select.ll index 0ed4a2c..b8fee00 100644 --- a/test/Analysis/BasicAA/phi-and-select.ll +++ b/test/Analysis/BasicAA/phi-and-select.ll @@ -1,8 +1,17 @@ -; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output \ -; RUN: |& grep {NoAlias: double\\* \[%\]a, double\\* \[%\]b\$} | count 4 +; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s ; BasicAA should detect NoAliases in PHIs and Selects. +; CHECK: Function: foo +; CHECK: NoAlias: double* %a, double* %b +; CHECK: Function: bar +; CHECK: NoAlias: double* %a, double* %b +; CHECK: Function: qux +; CHECK: NoAlias: double* %a, double* %b +; CHECK: Function: fin +; CHECK: NoAlias: double* %a, double* %b +; CHECK: ===== Alias Analysis Evaluator Report ===== + ; Two PHIs in the same block. define void @foo(i1 %m, double* noalias %x, double* noalias %y) { entry: diff --git a/test/Analysis/BasicAA/pure-const-dce.ll b/test/Analysis/BasicAA/pure-const-dce.ll index 54e6e79..266e607 100644 --- a/test/Analysis/BasicAA/pure-const-dce.ll +++ b/test/Analysis/BasicAA/pure-const-dce.ll @@ -1,7 +1,25 @@ -; RUN: opt < %s -basicaa -gvn -S | grep TestConst | count 2 -; RUN: opt < %s -basicaa -gvn -S | grep TestPure | count 3 -; RUN: opt < %s -basicaa -gvn -S | grep TestNone | count 4 -@g = global i32 0 ; <i32*> [#uses=1] +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s + +@g = global i32 0 + +; CHECK: @test +; CHECK: entry +; CHECK: %tmp0 = call i32 @TestConst(i32 5) readnone +; CHECK-NEXT: %tmp1 = call i32 @TestPure(i32 6) readonly +; CHECK-NEXT: %tmp2 = call i32 @TestNone(i32 7) +; CHECK-NEXT: store i32 1, i32* @g +; CHECK-NEXT: %tmp5 = call i32 @TestPure(i32 6) readonly +; CHECK-NEXT: %tmp7 = call i32 @TestNone(i32 7) +; CHECK-NEXT: %tmp8 = call i32 @TestNone(i32 7) +; CHECK-NEXT: %sum0 = add i32 %tmp0, %tmp1 +; CHECK-NEXT: %sum1 = add i32 %sum0, %tmp2 +; CHECK-NEXT: %sum2 = add i32 %sum1, %tmp0 +; CHECK-NEXT: %sum3 = add i32 %sum2, %tmp0 +; CHECK-NEXT: %sum4 = add i32 %sum3, %tmp5 +; CHECK-NEXT: %sum5 = add i32 %sum4, %tmp5 +; CHECK-NEXT: %sum6 = add i32 %sum5, %tmp7 +; CHECK-NEXT: %sum7 = add i32 %sum6, %tmp8 +; CHECK-NEXT: ret i32 %sum7 define i32 @test() { entry: diff --git a/test/Analysis/BasicAA/tailcall-modref.ll b/test/Analysis/BasicAA/tailcall-modref.ll index f7d6c57..ebeb28c 100644 --- a/test/Analysis/BasicAA/tailcall-modref.ll +++ b/test/Analysis/BasicAA/tailcall-modref.ll @@ -1,11 +1,7 @@ -; RUN: opt < %s -basicaa -gvn -instcombine |\ -; RUN: llvm-dis | grep {ret i32 0} - -declare void @foo(i32*) - -declare void @bar() +; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s define i32 @test() { +; CHECK: ret i32 0 %A = alloca i32 ; <i32*> [#uses=3] call void @foo( i32* %A ) %X = load i32* %A ; <i32> [#uses=1] @@ -14,3 +10,7 @@ define i32 @test() { %Z = sub i32 %X, %Y ; <i32> [#uses=1] ret i32 %Z } + +declare void @foo(i32*) + +declare void @bar() |