[llvm] r284628 - [AliasSetTracker] Return void for add() functions. NFC.
Chad Rosier via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 11:50:32 PDT 2016
Author: mcrosier
Date: Wed Oct 19 13:50:32 2016
New Revision: 284628
URL: http://llvm.org/viewvc/llvm-project?rev=284628&view=rev
Log:
[AliasSetTracker] Return void for add() functions. NFC.
Differential Revision: https://reviews.llvm.org/D25748
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=284628&r1=284627&r2=284628&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasSetTracker.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasSetTracker.h Wed Oct 19 13:50:32 2016
@@ -344,15 +344,15 @@ public:
/// These methods return true if inserting the instruction resulted in the
/// addition of a new alias set (i.e., the pointer did not alias anything).
///
- bool add(Value *Ptr, uint64_t Size, const AAMDNodes &AAInfo); // Add a loc.
- bool add(LoadInst *LI);
- bool add(StoreInst *SI);
- bool add(VAArgInst *VAAI);
- bool add(MemSetInst *MSI);
- bool add(Instruction *I); // Dispatch to one of the other add methods...
+ void add(Value *Ptr, uint64_t Size, const AAMDNodes &AAInfo); // Add a loc.
+ void add(LoadInst *LI);
+ void add(StoreInst *SI);
+ void add(VAArgInst *VAAI);
+ void add(MemSetInst *MSI);
+ void add(Instruction *I); // Dispatch to one of the other add methods...
void add(BasicBlock &BB); // Add all instructions in basic block
void add(const AliasSetTracker &AST); // Add alias relations from another AST
- bool addUnknown(Instruction *I);
+ void addUnknown(Instruction *I);
void clear();
@@ -364,8 +364,7 @@ public:
/// set is created to contain the pointer (because the pointer didn't alias
/// anything).
AliasSet &getAliasSetForPointer(Value *P, uint64_t Size,
- const AAMDNodes &AAInfo,
- bool *New = nullptr);
+ const AAMDNodes &AAInfo);
/// Return the alias set containing the location specified if one exists,
/// otherwise return null.
@@ -427,7 +426,7 @@ private:
}
AliasSet &addPointer(Value *P, uint64_t Size, const AAMDNodes &AAInfo,
- AliasSet::AccessLattice E, bool &NewSet);
+ AliasSet::AccessLattice E);
AliasSet *mergeAliasSetsForPointer(const Value *Ptr, uint64_t 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=284628&r1=284627&r2=284628&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Wed Oct 19 13:50:32 2016
@@ -289,8 +289,7 @@ AliasSet *AliasSetTracker::findAliasSetF
/// getAliasSetForPointer - Return the alias set that the specified pointer
/// lives in.
AliasSet &AliasSetTracker::getAliasSetForPointer(Value *Pointer, uint64_t Size,
- const AAMDNodes &AAInfo,
- bool *New) {
+ const AAMDNodes &AAInfo) {
AliasSet::PointerRec &Entry = getEntryFor(Pointer);
if (AliasAnyAS) {
@@ -328,68 +327,55 @@ AliasSet &AliasSetTracker::getAliasSetFo
return *AS;
}
- if (New) *New = true;
// Otherwise create a new alias set to hold the loaded pointer.
AliasSets.push_back(new AliasSet());
AliasSets.back().addPointer(*this, Entry, Size, AAInfo);
return AliasSets.back();
}
-bool AliasSetTracker::add(Value *Ptr, uint64_t Size, const AAMDNodes &AAInfo) {
- bool NewPtr;
- addPointer(Ptr, Size, AAInfo, AliasSet::NoAccess, NewPtr);
- return NewPtr;
+void AliasSetTracker::add(Value *Ptr, uint64_t Size, const AAMDNodes &AAInfo) {
+ addPointer(Ptr, Size, AAInfo, AliasSet::NoAccess);
}
-
-bool AliasSetTracker::add(LoadInst *LI) {
+void AliasSetTracker::add(LoadInst *LI) {
if (isStrongerThanMonotonic(LI->getOrdering())) return addUnknown(LI);
AAMDNodes AAInfo;
LI->getAAMetadata(AAInfo);
AliasSet::AccessLattice Access = AliasSet::RefAccess;
- bool NewPtr;
const DataLayout &DL = LI->getModule()->getDataLayout();
AliasSet &AS = addPointer(LI->getOperand(0),
- DL.getTypeStoreSize(LI->getType()),
- AAInfo, Access, NewPtr);
+ DL.getTypeStoreSize(LI->getType()), AAInfo, Access);
if (LI->isVolatile()) AS.setVolatile();
- return NewPtr;
}
-bool AliasSetTracker::add(StoreInst *SI) {
+void AliasSetTracker::add(StoreInst *SI) {
if (isStrongerThanMonotonic(SI->getOrdering())) return addUnknown(SI);
AAMDNodes AAInfo;
SI->getAAMetadata(AAInfo);
AliasSet::AccessLattice Access = AliasSet::ModAccess;
- bool NewPtr;
const DataLayout &DL = SI->getModule()->getDataLayout();
Value *Val = SI->getOperand(0);
- AliasSet &AS = addPointer(SI->getOperand(1),
- DL.getTypeStoreSize(Val->getType()),
- AAInfo, Access, NewPtr);
+ AliasSet &AS = addPointer(
+ SI->getOperand(1), DL.getTypeStoreSize(Val->getType()), AAInfo, Access);
if (SI->isVolatile()) AS.setVolatile();
- return NewPtr;
}
-bool AliasSetTracker::add(VAArgInst *VAAI) {
+void AliasSetTracker::add(VAArgInst *VAAI) {
AAMDNodes AAInfo;
VAAI->getAAMetadata(AAInfo);
- bool NewPtr;
addPointer(VAAI->getOperand(0), MemoryLocation::UnknownSize, AAInfo,
- AliasSet::ModRefAccess, NewPtr);
- return NewPtr;
+ AliasSet::ModRefAccess);
}
-bool AliasSetTracker::add(MemSetInst *MSI) {
+void AliasSetTracker::add(MemSetInst *MSI) {
AAMDNodes AAInfo;
MSI->getAAMetadata(AAInfo);
- bool NewPtr;
uint64_t Len;
if (ConstantInt *C = dyn_cast<ConstantInt>(MSI->getLength()))
@@ -398,30 +384,28 @@ bool AliasSetTracker::add(MemSetInst *MS
Len = MemoryLocation::UnknownSize;
AliasSet &AS =
- addPointer(MSI->getRawDest(), Len, AAInfo, AliasSet::ModAccess, NewPtr);
+ addPointer(MSI->getRawDest(), Len, AAInfo, AliasSet::ModAccess);
if (MSI->isVolatile())
AS.setVolatile();
- return NewPtr;
}
-bool AliasSetTracker::addUnknown(Instruction *Inst) {
- if (isa<DbgInfoIntrinsic>(Inst))
- return true; // Ignore DbgInfo Intrinsics.
+void AliasSetTracker::addUnknown(Instruction *Inst) {
+ if (isa<DbgInfoIntrinsic>(Inst))
+ return; // Ignore DbgInfo Intrinsics.
if (!Inst->mayReadOrWriteMemory())
- return true; // doesn't alias anything
+ return; // doesn't alias anything
AliasSet *AS = findAliasSetForUnknownInst(Inst);
if (AS) {
AS->addUnknownInst(Inst, AA);
- return false;
+ return;
}
AliasSets.push_back(new AliasSet());
AS = &AliasSets.back();
AS->addUnknownInst(Inst, AA);
- return true;
}
-bool AliasSetTracker::add(Instruction *I) {
+void AliasSetTracker::add(Instruction *I) {
// Dispatch to one of the other add methods.
if (LoadInst *LI = dyn_cast<LoadInst>(I))
return add(LI);
@@ -432,7 +416,7 @@ bool AliasSetTracker::add(Instruction *I
if (MemSetInst *MSI = dyn_cast<MemSetInst>(I))
return add(MSI);
return addUnknown(I);
- // FIXME: add support of memcpy and memmove.
+ // FIXME: add support of memcpy and memmove.
}
void AliasSetTracker::add(BasicBlock &BB) {
@@ -456,11 +440,10 @@ void AliasSetTracker::add(const AliasSet
add(AS.UnknownInsts[i]);
// Loop over all of the pointers in this alias set.
- bool X;
for (AliasSet::iterator ASI = AS.begin(), E = AS.end(); ASI != E; ++ASI) {
- AliasSet &NewAS = addPointer(ASI.getPointer(), ASI.getSize(),
- ASI.getAAInfo(),
- (AliasSet::AccessLattice)AS.Access, X);
+ AliasSet &NewAS =
+ addPointer(ASI.getPointer(), ASI.getSize(), ASI.getAAInfo(),
+ (AliasSet::AccessLattice)AS.Access);
if (AS.isVolatile()) NewAS.setVolatile();
}
}
@@ -571,10 +554,9 @@ AliasSet &AliasSetTracker::mergeAllAlias
AliasSet &AliasSetTracker::addPointer(Value *P, uint64_t Size,
const AAMDNodes &AAInfo,
- AliasSet::AccessLattice E, bool &NewSet) {
+ AliasSet::AccessLattice E) {
- NewSet = false;
- AliasSet &AS = getAliasSetForPointer(P, Size, AAInfo, &NewSet);
+ AliasSet &AS = getAliasSetForPointer(P, Size, AAInfo);
AS.Access |= E;
if (!AliasAnyAS && (TotalMayAliasSetSize > SaturationThreshold)) {
More information about the llvm-commits
mailing list