From 6be73e7eade32430d605bdfc7e4fe8546060599f Mon Sep 17 00:00:00 2001 From: Alina Sbirlea Date: Mon, 29 Oct 2018 22:25:59 +0000 Subject: [PATCH] [AliasSetTracker] Cleanup addPointer interface. [NFCI] Summary: Attempting to simplify the addPointer interface. Currently there's code decomposing a MemoryLocation into (Ptr, Size, AAMDNodes) only to recreate the MemoryLocation inside the call. Reviewers: reames, mkazantsev Subscribers: sanjoy, jlebar, llvm-commits Differential Revision: https://reviews.llvm.org/D53836 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345548 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/AliasSetTracker.h | 7 +------ lib/Analysis/AliasSetTracker.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h index cf4981d1eb2..d24453749fe 100644 --- a/include/llvm/Analysis/AliasSetTracker.h +++ b/include/llvm/Analysis/AliasSetTracker.h @@ -441,12 +441,7 @@ private: return *Entry; } - AliasSet &addPointer(Value *P, LocationSize Size, const AAMDNodes &AAInfo, - AliasSet::AccessLattice E); - AliasSet &addPointer(MemoryLocation Loc, - AliasSet::AccessLattice E) { - return addPointer(const_cast(Loc.Ptr), Loc.Size, Loc.AATags, E); - } + AliasSet &addPointer(MemoryLocation Loc, AliasSet::AccessLattice E); AliasSet *mergeAliasSetsForPointer(const Value *Ptr, LocationSize Size, const AAMDNodes &AAInfo); diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index 66544c51446..22c8ae20113 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -383,7 +383,7 @@ AliasSet &AliasSetTracker::getAliasSetFor(const MemoryLocation &MemLoc) { void AliasSetTracker::add(Value *Ptr, LocationSize Size, const AAMDNodes &AAInfo) { - addPointer(Ptr, Size, AAInfo, AliasSet::NoAccess); + addPointer(MemoryLocation(Ptr, Size, AAInfo), AliasSet::NoAccess); } void AliasSetTracker::add(LoadInst *LI) { @@ -518,8 +518,9 @@ void AliasSetTracker::add(const AliasSetTracker &AST) { // Loop over all of the pointers in this alias set. for (AliasSet::iterator ASI = AS.begin(), E = AS.end(); ASI != E; ++ASI) - addPointer(ASI.getPointer(), ASI.getSize(), ASI.getAAInfo(), - (AliasSet::AccessLattice)AS.Access); + addPointer( + MemoryLocation(ASI.getPointer(), ASI.getSize(), ASI.getAAInfo()), + (AliasSet::AccessLattice)AS.Access); } } @@ -612,10 +613,9 @@ AliasSet &AliasSetTracker::mergeAllAliasSets() { return *AliasAnyAS; } -AliasSet &AliasSetTracker::addPointer(Value *P, LocationSize Size, - const AAMDNodes &AAInfo, +AliasSet &AliasSetTracker::addPointer(MemoryLocation Loc, AliasSet::AccessLattice E) { - AliasSet &AS = getAliasSetFor(MemoryLocation(P, Size, AAInfo)); + AliasSet &AS = getAliasSetFor(Loc); AS.Access |= E; if (!AliasAnyAS && (TotalMayAliasSetSize > SaturationThreshold)) { -- 2.11.0