[llvm] r339625 - [AST] Cleanup code by using MemoryLocation utility [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 13 15:25:16 PDT 2018
Author: reames
Date: Mon Aug 13 15:25:16 2018
New Revision: 339625
URL: http://llvm.org/viewvc/llvm-project?rev=339625&view=rev
Log:
[AST] Cleanup code by using MemoryLocation utility [NFC]
Differential Revision: https://reviews.llvm.org/D50588
Modified:
llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
llvm/trunk/lib/Analysis/AliasSetTracker.cpp
Modified: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasSetTracker.h?rev=339625&r1=339624&r2=339625&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasSetTracker.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasSetTracker.h Mon Aug 13 15:25:16 2018
@@ -461,6 +461,10 @@ private:
AliasSet &addPointer(Value *P, LocationSize Size, const AAMDNodes &AAInfo,
AliasSet::AccessLattice E);
+ AliasSet &addPointer(MemoryLocation Loc,
+ AliasSet::AccessLattice E) {
+ return addPointer(const_cast<Value*>(Loc.Ptr), Loc.Size, Loc.AATags, E);
+ }
AliasSet *mergeAliasSetsForPointer(const Value *Ptr, LocationSize Size,
const AAMDNodes &AAInfo);
Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=339625&r1=339624&r2=339625&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Mon Aug 13 15:25:16 2018
@@ -357,71 +357,39 @@ void AliasSetTracker::add(Value *Ptr, Lo
void AliasSetTracker::add(LoadInst *LI) {
if (isStrongerThanMonotonic(LI->getOrdering())) return addUnknown(LI);
- AAMDNodes AAInfo;
- LI->getAAMetadata(AAInfo);
-
- AliasSet::AccessLattice Access = AliasSet::RefAccess;
- const DataLayout &DL = LI->getModule()->getDataLayout();
- AliasSet &AS = addPointer(LI->getOperand(0),
- DL.getTypeStoreSize(LI->getType()), AAInfo, Access);
+ auto MemLoc = MemoryLocation::get(LI);
+ AliasSet &AS = addPointer(MemLoc, AliasSet::RefAccess);
if (LI->isVolatile()) AS.setVolatile();
}
void AliasSetTracker::add(StoreInst *SI) {
if (isStrongerThanMonotonic(SI->getOrdering())) return addUnknown(SI);
- AAMDNodes AAInfo;
- SI->getAAMetadata(AAInfo);
-
- AliasSet::AccessLattice Access = AliasSet::ModAccess;
- const DataLayout &DL = SI->getModule()->getDataLayout();
- Value *Val = SI->getOperand(0);
- AliasSet &AS = addPointer(
- SI->getOperand(1), DL.getTypeStoreSize(Val->getType()), AAInfo, Access);
+ auto MemLoc = MemoryLocation::get(SI);
+ AliasSet &AS = addPointer(MemLoc, AliasSet::ModAccess);
if (SI->isVolatile()) AS.setVolatile();
}
void AliasSetTracker::add(VAArgInst *VAAI) {
- AAMDNodes AAInfo;
- VAAI->getAAMetadata(AAInfo);
-
- addPointer(VAAI->getOperand(0), MemoryLocation::UnknownSize, AAInfo,
+ addPointer(MemoryLocation::get(VAAI),
AliasSet::ModRefAccess);
}
void AliasSetTracker::add(AnyMemSetInst *MSI) {
- AAMDNodes AAInfo;
- MSI->getAAMetadata(AAInfo);
-
- uint64_t Len;
-
- if (ConstantInt *C = dyn_cast<ConstantInt>(MSI->getLength()))
- Len = C->getZExtValue();
- else
- Len = MemoryLocation::UnknownSize;
-
- AliasSet &AS =
- addPointer(MSI->getRawDest(), Len, AAInfo, AliasSet::ModAccess);
+ auto MemLoc = MemoryLocation::getForDest(MSI);
+ AliasSet &AS = addPointer(MemLoc, AliasSet::ModAccess);
auto *MS = dyn_cast<MemSetInst>(MSI);
if (MS && MS->isVolatile())
AS.setVolatile();
}
void AliasSetTracker::add(AnyMemTransferInst *MTI) {
- AAMDNodes AAInfo;
- MTI->getAAMetadata(AAInfo);
-
- uint64_t Len;
- if (ConstantInt *C = dyn_cast<ConstantInt>(MTI->getLength()))
- Len = C->getZExtValue();
- else
- Len = MemoryLocation::UnknownSize;
+ auto SrcLoc = MemoryLocation::getForSource(MTI);
+ auto DestLoc = MemoryLocation::getForDest(MTI);
- AliasSet &ASSrc =
- addPointer(MTI->getRawSource(), Len, AAInfo, AliasSet::RefAccess);
+ AliasSet &ASSrc = addPointer(SrcLoc, AliasSet::RefAccess);
- AliasSet &ASDst =
- addPointer(MTI->getRawDest(), Len, AAInfo, AliasSet::ModAccess);
+ AliasSet &ASDst = addPointer(DestLoc, AliasSet::ModAccess);
auto* MT = dyn_cast<MemTransferInst>(MTI);
if (MT && MT->isVolatile()) {
More information about the llvm-commits
mailing list