llvm.org GIT mirror llvm / 782574b
[AliasSetTracker] Misc cleanup (NFCI) Summary: Remove two redundant checks, add one in the unit test. Remove an unused method. Fix computation of TotalMayAliasSetSize. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345911 91177308-0d34-0410-b5e6-96231b3b80d8 Alina Sbirlea 10 months ago
3 changed file(s) with 8 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
388388 /// set is returned.
389389 AliasSet &getAliasSetFor(const MemoryLocation &MemLoc);
390390
391 /// Return true if the specified instruction "may" (or must) alias one of the
392 /// members in any of the sets.
393 bool containsUnknown(const Instruction *I) const;
394
395391 /// Return the underlying alias analysis object used by this tracker.
396392 AliasAnalysis &getAliasAnalysis() const { return AA; }
397393
113113 if (AliasSet *Fwd = AS->Forward) {
114114 Fwd->dropRef(*this);
115115 AS->Forward = nullptr;
116 }
117
118 if (AS->Alias == AliasSet::SetMayAlias)
119 TotalMayAliasSetSize -= AS->size();
116 } else // Update TotalMayAliasSetSize only if not forwarding.
117 if (AS->Alias == AliasSet::SetMayAlias)
118 TotalMayAliasSetSize -= AS->size();
120119
121120 AliasSets.erase(AS);
122121 }
231230 if (AliasAny)
232231 return true;
233232
234 if (!Inst->mayReadOrWriteMemory())
235 return false;
233 assert(Inst->mayReadOrWriteMemory() &&
234 "Instruction must either read or write memory.");
236235
237236 for (unsigned i = 0, e = UnknownInsts.size(); i != e; ++i) {
238237 if (auto *UnknownInst = getUnknownInst(i)) {
310309 return FoundSet;
311310 }
312311
313 bool AliasSetTracker::containsUnknown(const Instruction *Inst) const {
314 for (const AliasSet &AS : *this)
315 if (!AS.Forward && AS.aliasesUnknownInst(Inst, AA))
316 return true;
317 return false;
318 }
319
320312 AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) {
321313 AliasSet *FoundSet = nullptr;
322314 for (iterator I = begin(), E = end(); I != E;) {
325317 continue;
326318 if (!FoundSet) // If this is the first alias set ptr can go into.
327319 FoundSet = &*Cur; // Remember it.
328 else if (!Cur->Forward) // Otherwise, we must merge the sets.
320 else // Otherwise, we must merge the sets.
329321 FoundSet->mergeSetIn(*Cur, *this); // Merge in contents.
330322 }
331323 return FoundSet;
7777 for (auto &Inst : *Test->begin()) {
7878 bool FoundAS = false;
7979 for (AliasSet &AS : AST) {
80 if (!Inst.mayReadOrWriteMemory())
81 continue;
8082 if (!AS.aliasesUnknownInst(&Inst, AA))
8183 continue;
8284 ASSERT_NE(FoundAS, true);