summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-06 01:48:06 +0000
committerChris Lattner <sabre@nondot.org>2010-12-06 01:48:06 +0000
commitcc10244d7725f191bdc91cd62befff0c97257c7b (patch)
tree79ce2ec92470d1999df7a3eae7b934c8b9242211 /include
parent72c194a8be83d217360ebc6b1f3ad21c5ffa16a9 (diff)
downloadllvm-cc10244d7725f191bdc91cd62befff0c97257c7b.tar.gz
llvm-cc10244d7725f191bdc91cd62befff0c97257c7b.tar.bz2
llvm-cc10244d7725f191bdc91cd62befff0c97257c7b.tar.xz
Fix PR8728, a miscompilation I recently introduced. When optimizing
memcpy's like: memcpy(A, B) memcpy(A, C) we cannot delete the first memcpy as dead if A and C might be aliases. If so, we actually get: memcpy(A, B) memcpy(A, A) which is not correct to transform into: memcpy(A, A) This patch was heavily influenced by Jakub Staszak's patch in PR8728, thanks Jakub! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120974 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/AliasAnalysis.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h
index 7d5c5fc99b..167371b6b2 100644
--- a/include/llvm/Analysis/AliasAnalysis.h
+++ b/include/llvm/Analysis/AliasAnalysis.h
@@ -188,6 +188,11 @@ public:
return alias(LocA, LocB) == MustAlias;
}
+ /// isMustAlias - A convenience wrapper.
+ bool isMustAlias(const Value *V1, const Value *V2) {
+ return alias(V1, 1, V2, 1) == MustAlias;
+ }
+
/// pointsToConstantMemory - If the specified memory location is
/// known to be constant, return true. If OrLocal is true and the
/// specified memory location is known to be "local" (derived from