[polly] [llvm] [AST] Don't merge memory locations in AliasSetTracker (PR #65731)
Bruno De Fraine via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 22 13:58:09 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.
----------------
brunodf-snps wrote:
The reason not use `SmallSetVector` was to do the allocations upfront, using `MemoryLocs.size()` as a good estimate and upper bound of the size. But that was probably overthinking it. I now switched to `SmallSetVector` with `takeVector()` as suggested (commit efc787bc5d61). If `SmallSetVector` ever gains a `reserve` that could still be used here.
https://github.com/llvm/llvm-project/pull/65731
More information about the llvm-commits
mailing list