Revert commit 122654 at the request of Chris, who reckons that instsimplify
[oota-llvm.git] / lib / Analysis / AliasAnalysis.cpp
index f452c9e67661b776588de7cc49facfa910e86472..7a94c431deeafe49825175aed8caec13f0379757 100644 (file)
@@ -219,18 +219,24 @@ 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 
-AliasAnalysis::getLocationForDest(const MemTransferInst *MTI) {
+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);
 }