summaryrefslogtreecommitdiff
path: root/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-06-04 00:46:31 +0000
committerDan Gohman <gohman@apple.com>2011-06-04 00:46:31 +0000
commitc122c625ce018e33f25ba35150bed10183ae2b40 (patch)
tree1d823aa0a7126c0efd3627ad6b2895d176eb8c62 /lib/Analysis/BasicAliasAnalysis.cpp
parent1fc18d71deb0e23a9101c87bb7b1455098ce1c09 (diff)
downloadllvm-c122c625ce018e33f25ba35150bed10183ae2b40.tar.gz
llvm-c122c625ce018e33f25ba35150bed10183ae2b40.tar.bz2
llvm-c122c625ce018e33f25ba35150bed10183ae2b40.tar.xz
Reapply r131781 (revert r131809), now that some BasicAA shortcomings
it exposed are fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132611 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 24297d4a0f..3d10a5fd4d 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -944,7 +944,17 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
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