aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Analysis/BasicAA/featuretest.ll11
-rw-r--r--test/Transforms/BasicAA/featuretest.ll11
2 files changed, 22 insertions, 0 deletions
diff --git a/test/Analysis/BasicAA/featuretest.ll b/test/Analysis/BasicAA/featuretest.ll
index d2be1cef99..6884df2db5 100644
--- a/test/Analysis/BasicAA/featuretest.ll
+++ b/test/Analysis/BasicAA/featuretest.ll
@@ -40,3 +40,14 @@ int %constant_array_index_test() {
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
+}
+
diff --git a/test/Transforms/BasicAA/featuretest.ll b/test/Transforms/BasicAA/featuretest.ll
index d2be1cef99..6884df2db5 100644
--- a/test/Transforms/BasicAA/featuretest.ll
+++ b/test/Transforms/BasicAA/featuretest.ll
@@ -40,3 +40,14 @@ int %constant_array_index_test() {
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
+}
+