diff options
author | Dan Gohman <gohman@apple.com> | 2010-12-16 02:51:19 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-12-16 02:51:19 +0000 |
commit | e1a17a3473e86bbad4badd2a26b12326cbbe2307 (patch) | |
tree | d92941d3f369560603bcefb324e6f066be2d8697 /llvm/lib/Analysis/AliasAnalysis.cpp | |
parent | 13eb0eaea7351ba46584d6a86a7fc572e941dcae (diff) | |
download | bcm5719-llvm-e1a17a3473e86bbad4badd2a26b12326cbbe2307.tar.gz bcm5719-llvm-e1a17a3473e86bbad4badd2a26b12326cbbe2307.zip |
Make memcpyopt TBAA-aware.
llvm-svn: 121944
Diffstat (limited to 'llvm/lib/Analysis/AliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/AliasAnalysis.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp index 588d68da33b..7a94c431dee 100644 --- a/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/llvm/lib/Analysis/AliasAnalysis.cpp @@ -219,8 +219,11 @@ AliasAnalysis::getLocationForSource(const MemTransferInst *MTI) { if (ConstantInt *C = dyn_cast<ConstantInt>(MTI->getLength())) Size = C->getValue().getZExtValue(); - // FIXME: Can memcpy/memmove have TBAA tags? - return Location(MTI->getRawSource(), Size, 0); + // memcpy/memmove can have TBAA tags. For memcpy, they apply + // to both the source and the destination. + MDNode *TBAATag = MTI->getMetadata(LLVMContext::MD_tbaa); + + return Location(MTI->getRawSource(), Size, TBAATag); } AliasAnalysis::Location @@ -228,9 +231,12 @@ AliasAnalysis::getLocationForDest(const MemIntrinsic *MTI) { uint64_t Size = UnknownSize; if (ConstantInt *C = dyn_cast<ConstantInt>(MTI->getLength())) Size = C->getValue().getZExtValue(); + + // memcpy/memmove can have TBAA tags. For memcpy, they apply + // to both the source and the destination. + MDNode *TBAATag = MTI->getMetadata(LLVMContext::MD_tbaa); - // FIXME: Can memcpy/memmove have TBAA tags? - return Location(MTI->getRawDest(), Size, 0); + return Location(MTI->getRawDest(), Size, TBAATag); } |