aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-08 18:08:36 +0000
committerChris Lattner <sabre@nondot.org>2002-09-08 18:08:36 +0000
commite4f318c7fcf0cd1175fb9a33f8a84a6547d9115f (patch)
tree683d5da6f5b5740f73a7869e1dc6eacbb1d0ac8c /test
parent72846c2dcd4567f23731a946ebd4fe63f1259f1d (diff)
New testcase that tests for array pointer analysis type stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3615 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Analysis/BasicAA/featuretest.ll42
-rw-r--r--test/Transforms/BasicAA/featuretest.ll42
2 files changed, 84 insertions, 0 deletions
diff --git a/test/Analysis/BasicAA/featuretest.ll b/test/Analysis/BasicAA/featuretest.ll
new file mode 100644
index 0000000000..fdbb0ad646
--- /dev/null
+++ b/test/Analysis/BasicAA/featuretest.ll
@@ -0,0 +1,42 @@
+; This testcase tests for various features the basicaa test should be able to
+; determine, as noted in the comments.
+
+; RUN: if as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | grep REMOVE
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+
+; Array test: Test that operations on one local array do not invalidate
+; operations on another array. Important for scientific codes.
+;
+int %different_array_test(uint %A, uint %B) {
+ %Array1 = alloca int, uint 100
+ %Array2 = alloca int, uint 200
+
+ %pointer = getelementptr int* %Array1, uint %A
+ %val = load int* %pointer
+
+ %pointer2 = getelementptr int* %Array2, uint %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, uint 7
+ %P2 = getelementptr int* %Array, uint 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
+}
+
diff --git a/test/Transforms/BasicAA/featuretest.ll b/test/Transforms/BasicAA/featuretest.ll
new file mode 100644
index 0000000000..fdbb0ad646
--- /dev/null
+++ b/test/Transforms/BasicAA/featuretest.ll
@@ -0,0 +1,42 @@
+; This testcase tests for various features the basicaa test should be able to
+; determine, as noted in the comments.
+
+; RUN: if as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | grep REMOVE
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+
+; Array test: Test that operations on one local array do not invalidate
+; operations on another array. Important for scientific codes.
+;
+int %different_array_test(uint %A, uint %B) {
+ %Array1 = alloca int, uint 100
+ %Array2 = alloca int, uint 200
+
+ %pointer = getelementptr int* %Array1, uint %A
+ %val = load int* %pointer
+
+ %pointer2 = getelementptr int* %Array2, uint %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, uint 7
+ %P2 = getelementptr int* %Array, uint 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
+}
+