[llvm-commits] [llvm] r132611 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll
Dan Gohman
gohman at apple.com
Fri Jun 3 17:46:32 PDT 2011
Author: djg
Date: Fri Jun 3 19:46:31 2011
New Revision: 132611
URL: http://llvm.org/viewvc/llvm-project?rev=132611&view=rev
Log:
Reapply r131781 (revert r131809), now that some BasicAA shortcomings
it exposed are fixed.
Added:
llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll
- copied unchanged from r131808, llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll
Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
llvm/trunk/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=132611&r1=132610&r2=132611&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Fri Jun 3 19:46:31 2011
@@ -944,7 +944,17 @@
return NoAlias;
}
- return MayAlias;
+ // Statically, we can see that the base objects are the same, but the
+ // pointers have dynamic offsets which we can't resolve. And none of our
+ // little tricks above worked.
+ //
+ // TODO: Returning PartialAlias instead of MayAlias is a mild hack; the
+ // practical effect of this is protecting TBAA in the case of dynamic
+ // indices into arrays of unions. An alternative way to solve this would
+ // be to have clang emit extra metadata for unions and/or union accesses.
+ // A union-specific solution wouldn't handle the problem for malloc'd
+ // memory however.
+ return PartialAlias;
}
static AliasAnalysis::AliasResult
Modified: llvm/trunk/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll?rev=132611&r1=132610&r2=132611&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll (original)
+++ llvm/trunk/test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll Fri Jun 3 19:46:31 2011
@@ -1,4 +1,4 @@
-; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {1 may alias}
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {1 partial alias}
; PR7959
target datalayout = "e-p:32:32:32"
More information about the llvm-commits
mailing list