summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@codeaurora.org>2016-10-19 18:50:32 +0000
committerChad Rosier <mcrosier@codeaurora.org>2016-10-19 18:50:32 +0000
commit16970a847c00e9fac94b60b2179209edb24593ea (patch)
treeadb28285df3b1c99d7a1fa3f318ed325b65ec0aa
parentcf26c2747829838aed4b665dc92aa0e77090788b (diff)
downloadbcm5719-llvm-16970a847c00e9fac94b60b2179209edb24593ea.tar.gz
bcm5719-llvm-16970a847c00e9fac94b60b2179209edb24593ea.zip
[AliasSetTracker] Return void for add() functions. NFC.
Differential Revision: https://reviews.llvm.org/D25748 llvm-svn: 284628
-rw-r--r--llvm/include/llvm/Analysis/AliasSetTracker.h19
-rw-r--r--llvm/lib/Analysis/AliasSetTracker.cpp66
2 files changed, 33 insertions, 52 deletions
diff --git a/llvm/include/llvm/Analysis/AliasSetTracker.h b/llvm/include/llvm/Analysis/AliasSetTracker.h
index 5ebef3c69ec..d5db3306c84 100644
--- a/llvm/include/llvm/Analysis/AliasSetTracker.h
+++ b/llvm/include/llvm/Analysis/AliasSetTracker.h
@@ -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);
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp
index 943705b203d..f6fb87fc111 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -289,8 +289,7 @@ AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) {
/// 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::getAliasSetForPointer(Value *Pointer, uint64_t Size,
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 *MSI) {
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 AliasSetTracker &AST) {
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::mergeAllAliasSets() {
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)) {
OpenPOWER on IntegriCloud