[AliasSetTracker] Add support for memcpy and memmove.

Differential Revision: https://reviews.llvm.org/D25776

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284630 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chad Rosier
2016-10-19 19:09:03 +00:00
parent 6ca75fa2b4
commit db638de2de
3 changed files with 138 additions and 1 deletions
+23 -1
View File
@@ -389,6 +389,27 @@ void AliasSetTracker::add(MemSetInst *MSI) {
AS.setVolatile();
}
void AliasSetTracker::add(MemTransferInst *MTI) {
AAMDNodes AAInfo;
MTI->getAAMetadata(AAInfo);
uint64_t Len;
if (ConstantInt *C = dyn_cast<ConstantInt>(MTI->getLength()))
Len = C->getZExtValue();
else
Len = MemoryLocation::UnknownSize;
AliasSet &ASSrc =
addPointer(MTI->getRawSource(), Len, AAInfo, AliasSet::RefAccess);
if (MTI->isVolatile())
ASSrc.setVolatile();
AliasSet &ASDst =
addPointer(MTI->getRawDest(), Len, AAInfo, AliasSet::ModAccess);
if (MTI->isVolatile())
ASDst.setVolatile();
}
void AliasSetTracker::addUnknown(Instruction *Inst) {
if (isa<DbgInfoIntrinsic>(Inst))
return; // Ignore DbgInfo Intrinsics.
@@ -415,8 +436,9 @@ void AliasSetTracker::add(Instruction *I) {
return add(VAAI);
if (MemSetInst *MSI = dyn_cast<MemSetInst>(I))
return add(MSI);
if (MemTransferInst *MTI = dyn_cast<MemTransferInst>(I))
return add(MTI);
return addUnknown(I);
// FIXME: add support of memcpy and memmove.
}
void AliasSetTracker::add(BasicBlock &BB) {