[llvm] [InstrRef][NFC] Avoid another DenseMap, use a sorted vector (PR #99051)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 16 08:58:01 PDT 2024
================
@@ -439,17 +454,20 @@ class TransferTracker {
UseBeforeDefs.clear();
UseBeforeDefVariables.clear();
- // Map of the preferred location for each value.
- DenseMap<ValueIDNum, LocationAndQuality> ValueToLoc;
+ // Mapping of the preferred locations for each value. Collected into this
+ // vector then sorted for easy searching.
+ SmallVector<ValueLocPair, 16> ValueToLoc;
----------------
jmorse wrote:
We'd need to know the number of unique `ValueIDNum`s which then requires storage itself, so no easy way AFAIUI. I have in my notes (but don't have the original data any more, was over CTMark) that the median number of unique values used for variable locations in a block was 8, with the vast majority of the distribution being less than 20. So there's at least /some/ data behind all of this.
https://github.com/llvm/llvm-project/pull/99051
More information about the llvm-commits
mailing list