[llvm] [InstrRef][NFC] Avoid another DenseMap, use a sorted vector (PR #99051)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 08:46:17 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;
----------------
OCHyams wrote:

Any easy way to `reserve` here? And is smallsize of `16` more sensible then letting SmallVector choose? (I have no idea, just thinking out loud).

https://github.com/llvm/llvm-project/pull/99051


More information about the llvm-commits mailing list