summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/AliasSetTracker.cpp
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2018-11-01 23:37:51 +0000
committerAlina Sbirlea <asbirlea@google.com>2018-11-01 23:37:51 +0000
commitfd9722fbc6141ebaaa4f1e7f058457e0a7d460f4 (patch)
treeebec8de033eb848f1f3e4854ac43d04ab62dd62c /llvm/lib/Analysis/AliasSetTracker.cpp
parentd5779da11be0b289665499996ef4bcc92fd36714 (diff)
downloadbcm5719-llvm-fd9722fbc6141ebaaa4f1e7f058457e0a7d460f4.tar.gz
bcm5719-llvm-fd9722fbc6141ebaaa4f1e7f058457e0a7d460f4.zip
[AliasSetTracker] Misc cleanup (NFCI)
Summary: Remove two redundant checks, add one in the unit test. Remove an unused method. Fix computation of TotalMayAliasSetSize. llvm-svn: 345911
Diffstat (limited to 'llvm/lib/Analysis/AliasSetTracker.cpp')
-rw-r--r--llvm/lib/Analysis/AliasSetTracker.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp
index 22c8ae20113..c152b0ddeca 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -114,10 +114,9 @@ void AliasSetTracker::removeAliasSet(AliasSet *AS) {
if (AliasSet *Fwd = AS->Forward) {
Fwd->dropRef(*this);
AS->Forward = nullptr;
- }
-
- if (AS->Alias == AliasSet::SetMayAlias)
- TotalMayAliasSetSize -= AS->size();
+ } else // Update TotalMayAliasSetSize only if not forwarding.
+ if (AS->Alias == AliasSet::SetMayAlias)
+ TotalMayAliasSetSize -= AS->size();
AliasSets.erase(AS);
}
@@ -232,8 +231,8 @@ bool AliasSet::aliasesUnknownInst(const Instruction *Inst,
if (AliasAny)
return true;
- if (!Inst->mayReadOrWriteMemory())
- return false;
+ assert(Inst->mayReadOrWriteMemory() &&
+ "Instruction must either read or write memory.");
for (unsigned i = 0, e = UnknownInsts.size(); i != e; ++i) {
if (auto *UnknownInst = getUnknownInst(i)) {
@@ -311,13 +310,6 @@ AliasSet *AliasSetTracker::mergeAliasSetsForPointer(const Value *Ptr,
return FoundSet;
}
-bool AliasSetTracker::containsUnknown(const Instruction *Inst) const {
- for (const AliasSet &AS : *this)
- if (!AS.Forward && AS.aliasesUnknownInst(Inst, AA))
- return true;
- return false;
-}
-
AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) {
AliasSet *FoundSet = nullptr;
for (iterator I = begin(), E = end(); I != E;) {
@@ -326,7 +318,7 @@ AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) {
continue;
if (!FoundSet) // If this is the first alias set ptr can go into.
FoundSet = &*Cur; // Remember it.
- else if (!Cur->Forward) // Otherwise, we must merge the sets.
+ else // Otherwise, we must merge the sets.
FoundSet->mergeSetIn(*Cur, *this); // Merge in contents.
}
return FoundSet;
OpenPOWER on IntegriCloud