From acb7444b05b5a8bf7791ee0958d6ed8eaa6bf8ed Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 29 Jul 2004 01:34:10 +0000 Subject: [PATCH] Move Transforms/BasicAA to Analysis/BasicAA git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15316 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../BasicAA/2003-02-26-AccessSizeTest.ll | 18 ---- .../Transforms/BasicAA/2003-03-04-GEPCrash.ll | 7 -- .../BasicAA/2003-04-22-GEPProblem.ll | 15 ---- .../Transforms/BasicAA/2003-04-25-GEPCrash.ll | 7 -- .../BasicAA/2003-05-21-GEP-Problem.ll | 21 ----- .../BasicAA/2003-06-01-AliasCrash.ll | 11 --- .../BasicAA/2003-07-03-BasicAACrash.ll | 12 --- .../BasicAA/2003-09-19-LocalArgument.ll | 12 --- .../BasicAA/2003-11-04-SimpleCases.ll | 15 ---- .../BasicAA/2003-12-11-ConstExprGEP.ll | 17 ---- .../BasicAA/2004-01-29-InvariantMemory.llx | 12 --- .../BasicAA/2004-07-28-MustAliasbug.llx | 10 --- test/Transforms/BasicAA/featuretest.ll | 85 ------------------- test/Transforms/BasicAA/gcsetest.ll | 46 ---------- test/Transforms/BasicAA/licmtest.ll | 42 --------- 15 files changed, 330 deletions(-) delete mode 100644 test/Transforms/BasicAA/2003-02-26-AccessSizeTest.ll delete mode 100644 test/Transforms/BasicAA/2003-03-04-GEPCrash.ll delete mode 100644 test/Transforms/BasicAA/2003-04-22-GEPProblem.ll delete mode 100644 test/Transforms/BasicAA/2003-04-25-GEPCrash.ll delete mode 100644 test/Transforms/BasicAA/2003-05-21-GEP-Problem.ll delete mode 100644 test/Transforms/BasicAA/2003-06-01-AliasCrash.ll delete mode 100644 test/Transforms/BasicAA/2003-07-03-BasicAACrash.ll delete mode 100644 test/Transforms/BasicAA/2003-09-19-LocalArgument.ll delete mode 100644 test/Transforms/BasicAA/2003-11-04-SimpleCases.ll delete mode 100644 test/Transforms/BasicAA/2003-12-11-ConstExprGEP.ll delete mode 100644 test/Transforms/BasicAA/2004-01-29-InvariantMemory.llx delete mode 100644 test/Transforms/BasicAA/2004-07-28-MustAliasbug.llx delete mode 100644 test/Transforms/BasicAA/featuretest.ll delete mode 100644 test/Transforms/BasicAA/gcsetest.ll delete mode 100644 test/Transforms/BasicAA/licmtest.ll diff --git a/test/Transforms/BasicAA/2003-02-26-AccessSizeTest.ll b/test/Transforms/BasicAA/2003-02-26-AccessSizeTest.ll deleted file mode 100644 index fb44d94a578..00000000000 --- a/test/Transforms/BasicAA/2003-02-26-AccessSizeTest.ll +++ /dev/null @@ -1,18 +0,0 @@ -; This testcase makes sure that size is taken to account when alias analysis -; 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: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE - -int %test() { - %A = alloca int - store int 0, int* %A - %X = load int* %A - %B = cast int* %A to sbyte* - %C = getelementptr sbyte* %B, long 1 - store sbyte 1, sbyte* %C ; Aliases %A - %Y.DONOTREMOVE = load int* %A - %Z = sub int %X, %Y.DONOTREMOVE - ret int %Z -} - diff --git a/test/Transforms/BasicAA/2003-03-04-GEPCrash.ll b/test/Transforms/BasicAA/2003-03-04-GEPCrash.ll deleted file mode 100644 index 1f483278093..00000000000 --- a/test/Transforms/BasicAA/2003-03-04-GEPCrash.ll +++ /dev/null @@ -1,7 +0,0 @@ -; RUN: llvm-as < %s | opt -basicaa -aa-eval -disable-output -; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2 -void %test({[2 x int],[2 x int]}* %A, long %X, long %Y) { - %P1 = getelementptr {[2 x int],[2 x int]}* %A, long 0, ubyte 0, long %X - %P2 = getelementptr {[2 x int],[2 x int]}* %A, long 0, ubyte 1, long %Y - ret void -} diff --git a/test/Transforms/BasicAA/2003-04-22-GEPProblem.ll b/test/Transforms/BasicAA/2003-04-22-GEPProblem.ll deleted file mode 100644 index 70f71c22fb8..00000000000 --- a/test/Transforms/BasicAA/2003-04-22-GEPProblem.ll +++ /dev/null @@ -1,15 +0,0 @@ -; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep sub - -; BasicAA was incorrectly concluding that P1 and P2 didn't conflict! - -int %test(int *%Ptr, long %V) { - %P2 = getelementptr int* %Ptr, long 1 - %P1 = getelementptr int* %Ptr, long %V - %X = load int* %P1 - store int 5, int* %P2 - - %Y = load int* %P1 - - %Z = sub int %X, %Y - ret int %Z -} diff --git a/test/Transforms/BasicAA/2003-04-25-GEPCrash.ll b/test/Transforms/BasicAA/2003-04-25-GEPCrash.ll deleted file mode 100644 index 14013822f97..00000000000 --- a/test/Transforms/BasicAA/2003-04-25-GEPCrash.ll +++ /dev/null @@ -1,7 +0,0 @@ -; RUN: llvm-as < %s | opt -basicaa -aa-eval -disable-output -; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2 -void %test([17 x ushort]* %mask_bits) { - %P1 = getelementptr [17 x ushort]* %mask_bits, long 0, long 0 - %P2 = getelementptr [17 x ushort]* %mask_bits, long 252645134, long 0 - ret void -} diff --git a/test/Transforms/BasicAA/2003-05-21-GEP-Problem.ll b/test/Transforms/BasicAA/2003-05-21-GEP-Problem.ll deleted file mode 100644 index 7322e635ff9..00000000000 --- a/test/Transforms/BasicAA/2003-05-21-GEP-Problem.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: llvm-as < %s | opt -licm -disable-output - %struct..apr_array_header_t = type { int*, int, int, int, sbyte* } - %struct..apr_table_t = type { %struct..apr_array_header_t, uint, [32 x int], [32 x int] } - -void %table_reindex(%struct..apr_table_t* %t.1) { ; No predecessors! - br label %loopentry - -loopentry: ; preds = %0, %no_exit - %tmp.101 = getelementptr %struct..apr_table_t* %t.1, long 0, ubyte 0, ubyte 2 ; [#uses=1] - %tmp.11 = load int* %tmp.101 ; [#uses=0] - br bool false, label %no_exit, label %UnifiedExitNode - -no_exit: ; preds = %loopentry - %tmp.25 = cast int 0 to long ; [#uses=1] - %tmp.261 = getelementptr %struct..apr_table_t* %t.1, long 0, ubyte 3, long %tmp.25 ; [#uses=1] - store int 0, int* %tmp.261 - br label %loopentry - -UnifiedExitNode: ; preds = %loopentry - ret void -} diff --git a/test/Transforms/BasicAA/2003-06-01-AliasCrash.ll b/test/Transforms/BasicAA/2003-06-01-AliasCrash.ll deleted file mode 100644 index 2c2fbca5505..00000000000 --- a/test/Transforms/BasicAA/2003-06-01-AliasCrash.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: llvm-as < %s | opt -basicaa -aa-eval -disable-output - -int %MTConcat([3 x int]* %a.1) { - %tmp.961 = getelementptr [3 x int]* %a.1, long 0, long 4 - %tmp.97 = load int* %tmp.961 - %tmp.119 = getelementptr [3 x int]* %a.1, long 1, long 0 - %tmp.120 = load int* %tmp.119 - %tmp.1541 = getelementptr [3 x int]* %a.1, long 0, long 4 - %tmp.155 = load int* %tmp.1541 - ret int 0 -} diff --git a/test/Transforms/BasicAA/2003-07-03-BasicAACrash.ll b/test/Transforms/BasicAA/2003-07-03-BasicAACrash.ll deleted file mode 100644 index 916b52341cf..00000000000 --- a/test/Transforms/BasicAA/2003-07-03-BasicAACrash.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-as < %s | opt -basicaa -aa-eval -disable-output - - %struct..RefPoint = type { int, { uint, ushort, ushort } } - %struct..RefRect = type { %struct..RefPoint, %struct..RefPoint } - -implementation ; Functions: - -uint %BMT_CommitPartDrawObj() { - %tmp.19111 = getelementptr %struct..RefRect* null, long 0, ubyte 0, ubyte 1, ubyte 2 - %tmp.20311 = getelementptr %struct..RefRect* null, long 0, ubyte 1, ubyte 1, ubyte 2 - ret uint 0 -} diff --git a/test/Transforms/BasicAA/2003-09-19-LocalArgument.ll b/test/Transforms/BasicAA/2003-09-19-LocalArgument.ll deleted file mode 100644 index 90f7172e4ab..00000000000 --- a/test/Transforms/BasicAA/2003-09-19-LocalArgument.ll +++ /dev/null @@ -1,12 +0,0 @@ -; In this test, a local alloca cannot alias an incoming argument. - -; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | not grep sub - -int %test(int* %P) { - %X = alloca int - %V1 = load int* %P - store int 0, int* %X - %V2 = load int* %P - %Diff = sub int %V1, %V2 - ret int %Diff -} diff --git a/test/Transforms/BasicAA/2003-11-04-SimpleCases.ll b/test/Transforms/BasicAA/2003-11-04-SimpleCases.ll deleted file mode 100644 index 2b6c7e12e1e..00000000000 --- a/test/Transforms/BasicAA/2003-11-04-SimpleCases.ll +++ /dev/null @@ -1,15 +0,0 @@ -; This testcase consists of alias relations which should be completely -; resolvable by basicaa. - -; RUN: llvm-as < %s | opt -aa-eval -print-may-aliases 2>&1 -disable-output | not grep May: - -%T = type { uint, [10 x ubyte] } - -void %test(%T* %P) { - %A = getelementptr %T* %P, long 0 - %B = getelementptr %T* %P, long 0, ubyte 0 - %C = getelementptr %T* %P, long 0, ubyte 1 - %D = getelementptr %T* %P, long 0, ubyte 1, long 0 - %E = getelementptr %T* %P, long 0, ubyte 1, long 5 - ret void -} diff --git a/test/Transforms/BasicAA/2003-12-11-ConstExprGEP.ll b/test/Transforms/BasicAA/2003-12-11-ConstExprGEP.ll deleted file mode 100644 index 3b37b2c07c7..00000000000 --- a/test/Transforms/BasicAA/2003-12-11-ConstExprGEP.ll +++ /dev/null @@ -1,17 +0,0 @@ -; This testcase consists of alias relations which should be completely -; resolvable by basicaa, but require analysis of getelementptr constant exprs. - -; RUN: llvm-as < %s | opt -aa-eval -print-may-aliases 2>&1 -disable-output | not grep May: - -%T = type { uint, [10 x ubyte] } - -%G = external global %T - -void %test() { - %D = getelementptr %T* %G, long 0, ubyte 0 - %E = getelementptr %T* %G, long 0, ubyte 1, long 5 - %F = getelementptr uint* getelementptr (%T* %G, long 0, ubyte 0), long 0 - %X = getelementptr [10 x ubyte]* getelementptr (%T* %G, long 0, ubyte 1), long 0, long 5 - - ret void -} diff --git a/test/Transforms/BasicAA/2004-01-29-InvariantMemory.llx b/test/Transforms/BasicAA/2004-01-29-InvariantMemory.llx deleted file mode 100644 index cfc4c480cf4..00000000000 --- a/test/Transforms/BasicAA/2004-01-29-InvariantMemory.llx +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | not grep load - -%X = constant [2 x int] [int 4, int 5] - -int %test(int* %Y, long %idx) { - %P = getelementptr [2 x int]* %X, long 0, long %idx - %A = load int* %P ; Load from invariant memory - store int 4, int* %Y ; Store could not be to %X - %B = load int* %P - %C = sub int %A, %B - ret int %C -} diff --git a/test/Transforms/BasicAA/2004-07-28-MustAliasbug.llx b/test/Transforms/BasicAA/2004-07-28-MustAliasbug.llx deleted file mode 100644 index d1cf73b6ab4..00000000000 --- a/test/Transforms/BasicAA/2004-07-28-MustAliasbug.llx +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llvm-as < %s | opt -dse | llvm-dis | grep 'store int 0' - -void %test({int,int }* %P) { - %Q = getelementptr {int,int}* %P, int 1 - %X = getelementptr {int,int}* %Q, int 0, uint 1 - %Y = getelementptr {int,int}* %Q, int 1, uint 1 - store int 0, int* %X - store int 1, int* %Y - ret void -} diff --git a/test/Transforms/BasicAA/featuretest.ll b/test/Transforms/BasicAA/featuretest.ll deleted file mode 100644 index 7fc129dd1e5..00000000000 --- a/test/Transforms/BasicAA/featuretest.ll +++ /dev/null @@ -1,85 +0,0 @@ -; This testcase tests for various features the basicaa test should be able to -; determine, as noted in the comments. - -; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep REMOVE - -%Global = external global { int } - -implementation - - -; Array test: Test that operations on one local array do not invalidate -; operations on another array. Important for scientific codes. -; -int %different_array_test(long %A, long %B) { - %Array1 = alloca int, uint 100 - %Array2 = alloca int, uint 200 - - %pointer = getelementptr int* %Array1, long %A - %val = load int* %pointer - - %pointer2 = getelementptr int* %Array2, long %B - store int 7, int* %pointer2 - - %REMOVE = load int* %pointer ; redundant with above load - %retval = sub int %REMOVE, %val - ret int %retval -} - -; Constant index test: Constant indexes into the same array should not -; interfere with each other. Again, important for scientific codes. -; -int %constant_array_index_test() { - %Array = alloca int, uint 100 - %P1 = getelementptr int* %Array, long 7 - %P2 = getelementptr int* %Array, long 6 - - %A = load int* %P1 - store int 1, int* %P2 ; Should not invalidate load - %BREMOVE = load int* %P1 - %Val = sub int %A, %BREMOVE - ret int %Val -} - -; Test that if two pointers are spaced out by a constant getelementptr, that -; they cannot alias. -int %gep_distance_test(int* %A) { - %REMOVEu = load int* %A - %B = getelementptr int* %A, long 2 ; Cannot alias A - store int 7, int* %B - %REMOVEv = load int* %A - %r = sub int %REMOVEu, %REMOVEv - ret int %r -} - -; Test that if two pointers are spaced out by a constant offset, that they -; cannot alias, even if there is a variable offset between them... -int %gep_distance_test2({int,int}* %A, long %distance) { - %A = getelementptr {int,int}* %A, long 0, ubyte 0 - %REMOVEu = load int* %A - %B = getelementptr {int,int}* %A, long %distance, ubyte 1 - store int 7, int* %B ; B cannot alias A, it's at least 4 bytes away - %REMOVEv = load int* %A - %r = sub int %REMOVEu, %REMOVEv - ret int %r -} - -; Test that we can do funny pointer things and that distance calc will still -; work. -int %gep_distance_test3(int * %A) { - %X = load int* %A - %B = cast int* %A to sbyte* - %C = getelementptr sbyte* %B, long 4 - %Y = load sbyte* %C - ret int 8 -} - -; Test that we can disambiguate globals reached through constantexpr geps -int %constexpr_test() { - %X = alloca int - %Y = load int* %X - store int 5, int* getelementptr ({ int }* %Global, long 0, ubyte 0) - %REMOVE = load int* %X - %retval = sub int %Y, %REMOVE - ret int %retval -} diff --git a/test/Transforms/BasicAA/gcsetest.ll b/test/Transforms/BasicAA/gcsetest.ll deleted file mode 100644 index 4af5cc16db8..00000000000 --- a/test/Transforms/BasicAA/gcsetest.ll +++ /dev/null @@ -1,46 +0,0 @@ -; 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: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep load - -%A = global int 7 -%B = global int 8 -implementation - -int %test() { - %A1 = load int* %A - - store int 123, int* %B ; Store cannot alias %A - - %A2 = load int* %A - %X = sub int %A1, %A2 - ret int %X -} - -int %test2() { - %A1 = load int* %A - br label %Loop -Loop: - %AP = phi int [0, %0], [%X, %Loop] - store int %AP, int* %B ; Store cannot alias %A - - %A2 = load int* %A - %X = sub int %A1, %A2 - %c = seteq int %X, 0 - br bool %c, label %out, label %Loop - -out: - ret int %X -} - -declare void %external() - -int %test3() { - %X = alloca int - store int 7, int* %X - call void %external() - %V = load int* %X - ret int %V -} - diff --git a/test/Transforms/BasicAA/licmtest.ll b/test/Transforms/BasicAA/licmtest.ll deleted file mode 100644 index 56682c7cabf..00000000000 --- a/test/Transforms/BasicAA/licmtest.ll +++ /dev/null @@ -1,42 +0,0 @@ -; Test that LICM uses basicaa to do alias analysis, which is capable of -; disambiguating some obvious cases. If LICM is able to disambiguate the -; two pointers, then the load should be hoisted, and the store sunk. Thus -; the loop becomes empty and can be deleted by ADCE. - -; RUN: llvm-as < %s | opt -basicaa -licm --adce | llvm-dis | not grep Loop - -%A = global int 7 -%B = global int 8 -%C = global [2 x int ] [ int 4, int 8 ] -implementation - -int %test(bool %c) { - %Atmp = load int* %A - br label %Loop -Loop: - %ToRemove = load int* %A - store int %Atmp, int* %B ; Store cannot alias %A - - br bool %c, label %Out, label %Loop -Out: - %X = sub int %ToRemove, %Atmp - ret int %X -} - -int %test2(bool %c) { - br label %Loop -Loop: - %AVal = load int* %A - %C0 = getelementptr [2 x int ]* %C, long 0, long 0 - store int %AVal, int* %C0 ; Store cannot alias %A - - %BVal = load int* %B - %C1 = getelementptr [2 x int ]* %C, long 0, long 1 - store int %BVal, int* %C1 ; Store cannot alias %A, %B, or %C0 - - br bool %c, label %Out, label %Loop -Out: - %X = sub int %AVal, %BVal - ret int %X -} - -- 2.34.1