[polly] [llvm] [AST] Don't merge memory locations in AliasSetTracker (PR #65731)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 22 07:31:32 PST 2023
================
@@ -246,42 +191,54 @@ ModRefInfo AliasSet::aliasesUnknownInst(const Instruction *Inst,
}
ModRefInfo MR = ModRefInfo::NoModRef;
- for (iterator I = begin(), E = end(); I != E; ++I) {
- MR |= AA.getModRefInfo(
- Inst, MemoryLocation(I.getPointer(), I.getSize(), I.getAAInfo()));
+ for (const auto &ASMemLoc : MemoryLocs) {
+ MR |= AA.getModRefInfo(Inst, ASMemLoc);
if (isModAndRefSet(MR))
return MR;
}
return MR;
}
-void AliasSetTracker::clear() {
- // Delete all the PointerRec entries.
- for (auto &I : PointerMap)
- I.second->eraseFromList();
+AliasSet::PointerVector AliasSet::getPointers() const {
+ // To deduplicate pointer values, use a linear scan if the number of elements
+ // is small, or a set if large. This is the same idea as SmallSetVector. In
+ // addition, we can allocate space for the result vector upfront.
+ PointerVector Result;
+ if (MemoryLocs.size() <= Result.capacity()) {
+ for (const MemoryLocation &MemLoc : MemoryLocs)
+ if (llvm::find(Result, MemLoc.Ptr) == Result.end())
----------------
nikic wrote:
is_contained
https://github.com/llvm/llvm-project/pull/65731
More information about the llvm-commits
mailing list