[llvm] [Attributor] Change allocation size and load/store offsets using AAPointerInfo for Alloca instructions and keep track of instructions causing an Access (PR #72029)
Vidush Singhal via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 11:51:57 PST 2025
================
@@ -1459,16 +1593,23 @@ struct AAPointerInfoFloating : public AAPointerInfoImpl {
Size = AccessSize.getFixedValue();
// Make a strictly ascending list of offsets as required by addAccess()
- SmallVector<int64_t> OffsetsSorted(Offsets.begin(), Offsets.end());
- llvm::sort(OffsetsSorted);
+ auto Ranges = OI.Ranges;
+ auto Origins = OI.Origins;
+
+ llvm::sort(Ranges);
+ auto *Last = llvm::unique(Ranges);
+ Ranges.erase(Last, Ranges.end());
----------------
vidsinghal wrote:
The problem is that SmallSetVector in immutable, therefore we cannot sort the elements in place.
Another approach is to copy to a set then copy back to the small vector then sort but sorting dominates the time complexity since it is O(nlogn) therefore in my opinion we should just keep the original data structure SmallVector.
1.) Because we need sortedness property
2.) SmallVector is mutable therefore we can modify / sort in place.
https://github.com/llvm/llvm-project/pull/72029
More information about the llvm-commits
mailing list