[llvm-commits] [llvm] r100789 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp test/Analysis/BasicAA/empty.ll
Dan Gohman
gohman at apple.com
Thu Apr 8 11:11:50 PDT 2010
Author: djg
Date: Thu Apr 8 13:11:50 2010
New Revision: 100789
URL: http://llvm.org/viewvc/llvm-project?rev=100789&view=rev
Log:
Pointers to zero-sized objects don't point to overlapping objects.
Added:
llvm/trunk/test/Analysis/BasicAA/empty.ll
Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=100789&r1=100788&r2=100789&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Thu Apr 8 13:11:50 2010
@@ -655,6 +655,11 @@
AliasAnalysis::AliasResult
BasicAliasAnalysis::aliasCheck(const Value *V1, unsigned V1Size,
const Value *V2, unsigned V2Size) {
+ // If either of the memory references is empty, it doesn't matter what the
+ // pointer values are.
+ if (V1Size == 0 || V2Size == 0)
+ return NoAlias;
+
// Strip off any casts if they exist.
V1 = V1->stripPointerCasts();
V2 = V2->stripPointerCasts();
Added: llvm/trunk/test/Analysis/BasicAA/empty.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/empty.ll?rev=100789&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/BasicAA/empty.ll (added)
+++ llvm/trunk/test/Analysis/BasicAA/empty.ll Thu Apr 8 13:11:50 2010
@@ -0,0 +1,10 @@
+; RUN: opt < %s -aa-eval -print-all-alias-modref-info -disable-output \
+; RUN: |& grep {NoAlias: \{\}\\* \[%\]p, \{\}\\* \[%\]q}
+
+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"
+
+define void @foo({}* %p, {}* %q) {
+ store {} {}, {}* %p
+ store {} {}, {}* %q
+ ret void
+}
More information about the llvm-commits
mailing list