aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/AliasAnalysis.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-06-04 00:31:50 +0000
committerDan Gohman <gohman@apple.com>2011-06-04 00:31:50 +0000
commit1fc18d71deb0e23a9101c87bb7b1455098ce1c09 (patch)
treec3608fae328c29f981be6de0d4c44452f0d025e6 /include/llvm/Analysis/AliasAnalysis.h
parent865f09334f67edb2000fb38c6c3c28283b88b3bf (diff)
downloadexternal_llvm-1fc18d71deb0e23a9101c87bb7b1455098ce1c09.zip
external_llvm-1fc18d71deb0e23a9101c87bb7b1455098ce1c09.tar.gz
external_llvm-1fc18d71deb0e23a9101c87bb7b1455098ce1c09.tar.bz2
Fix BasicAA's recursion detection so that it doesn't pessimize
queries in the case of a DAG, where a query reaches a node visited earlier, but it's not on a cycle. This avoids MayAlias results in cases where BasicAA is expected to return MustAlias or PartialAlias in order to protect TBAA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/AliasAnalysis.h')
-rw-r--r--include/llvm/Analysis/AliasAnalysis.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h
index 8f9708b..5d8edd1 100644
--- a/include/llvm/Analysis/AliasAnalysis.h
+++ b/include/llvm/Analysis/AliasAnalysis.h
@@ -38,6 +38,7 @@
#define LLVM_ANALYSIS_ALIAS_ANALYSIS_H
#include "llvm/Support/CallSite.h"
+#include "llvm/ADT/DenseMap.h"
namespace llvm {
@@ -488,6 +489,32 @@ public:
}
};
+// Specialize DenseMapInfo for Location.
+template<>
+struct DenseMapInfo<AliasAnalysis::Location> {
+ static inline AliasAnalysis::Location getEmptyKey() {
+ return
+ AliasAnalysis::Location(DenseMapInfo<const Value *>::getEmptyKey(),
+ 0, 0);
+ }
+ static inline AliasAnalysis::Location getTombstoneKey() {
+ return
+ AliasAnalysis::Location(DenseMapInfo<const Value *>::getTombstoneKey(),
+ 0, 0);
+ }
+ static unsigned getHashValue(const AliasAnalysis::Location &Val) {
+ return DenseMapInfo<const Value *>::getHashValue(Val.Ptr) ^
+ DenseMapInfo<uint64_t>::getHashValue(Val.Size) ^
+ DenseMapInfo<const MDNode *>::getHashValue(Val.TBAATag);
+ }
+ static bool isEqual(const AliasAnalysis::Location &LHS,
+ const AliasAnalysis::Location &RHS) {
+ return LHS.Ptr == RHS.Ptr &&
+ LHS.Size == RHS.Size &&
+ LHS.TBAATag == RHS.TBAATag;
+ }
+};
+
/// isNoAliasCall - Return true if this pointer is returned by a noalias
/// function.
bool isNoAliasCall(const Value *V);