[llvm] [Attributor][FIX] Track returned pointer offsets (PR #110534)
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 14:54:26 PDT 2024
================
@@ -1495,16 +1477,16 @@ struct AAPointerInfoFloating : public AAPointerInfoImpl {
Size = AccessSize.getFixedValue();
// Make a strictly ascending list of offsets as required by addAccess()
- llvm::sort(Offsets);
- auto *Last = llvm::unique(Offsets);
- Offsets.erase(Last, Offsets.end());
+ SmallVector<int64_t> OffsetsSorted(Offsets.begin(), Offsets.end());
+ llvm::sort(OffsetsSorted);
----------------
jdoerfert wrote:
I had a SmallVectorSet, the issue is it doesn't help over the SmallSet, I think.
When we use it, thus when we need to be deterministic, we already sort it (above).
We'd still need to create a new vector to sort it if we had a SmallVectorSet.
In all the intermediate operations the vector part would not help, I think, since we don't care about the insertion order.
I'm not sure what you mean by "removal of redundancy". What I did is replace the vector with a set so we don't collect the same offset more than once during the traversal. In the end, we always sort them and make them unique anyway, before the offsets are used to create accesses.
https://github.com/llvm/llvm-project/pull/110534
More information about the llvm-commits
mailing list