summaryrefslogtreecommitdiff
path: root/test/Analysis/BasicAA/constant-over-index.ll
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-05-27 01:48:27 +0000
committerDan Gohman <gohman@apple.com>2009-05-27 01:48:27 +0000
commit72776d219014f6b07485e7dcc5a818849904e720 (patch)
treedff1ceaad2dda626f1639e0b34e6bd35fefda30b /test/Analysis/BasicAA/constant-over-index.ll
parent8c377c7296d8a8104231442c3f6c27296249ec5f (diff)
downloadllvm-72776d219014f6b07485e7dcc5a818849904e720.tar.gz
llvm-72776d219014f6b07485e7dcc5a818849904e720.tar.bz2
llvm-72776d219014f6b07485e7dcc5a818849904e720.tar.xz
Teach BasicAliasAnalysis to understand constant gep indices that fall
beyond their associated static array type. I believe that this fixes a legitimate bug, because BasicAliasAnalysis already has code to check for this condition that works for non-constant indices, however it was missing the case of constant indices. With this change, it checks for both. This fixes PR4267, and miscompiles of SPEC 188.ammp and 464.h264.href. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/BasicAA/constant-over-index.ll')
-rw-r--r--test/Analysis/BasicAA/constant-over-index.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Analysis/BasicAA/constant-over-index.ll b/test/Analysis/BasicAA/constant-over-index.ll
new file mode 100644
index 0000000000..e92995be5e
--- /dev/null
+++ b/test/Analysis/BasicAA/constant-over-index.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -aa-eval -print-all-alias-modref-info \
+; RUN: |& grep {MayAlias: double\\* \[%\]p.0.i.0, double\\* \[%\]p3\$}
+; PR4267
+
+; %p3 is equal to %p.0.i.0 on the second iteration of the loop,
+; so MayAlias is needed.
+
+define void @foo([3 x [3 x double]]* noalias %p) {
+entry:
+ %p3 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 0, i64 3
+ br label %loop
+
+loop:
+ %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
+
+ %p.0.i.0 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %i, i64 0
+
+ volatile store double 0.0, double* %p3
+ volatile store double 0.1, double* %p.0.i.0
+
+ %i.next = add i64 %i, 1
+ %cmp = icmp slt i64 %i.next, 3
+ br i1 %cmp, label %loop, label %exit
+
+exit:
+ ret void
+}