[llvm] [polly] [PassManager] Store analysis results in contiguous storage (PR #222003)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 01:03:41 PDT 2026


================
@@ -282,22 +282,22 @@ template <typename IRUnitT, typename... ExtraArgTs> class AnalysisManager {
 
   /// List of analysis pass IDs and associated concept pointers.
   ///
-  /// Requires iterators to be valid across appending new entries and arbitrary
-  /// erases. Provides the analysis ID to enable finding iterators to a given
-  /// entry in maps below, and provides the storage for the actual result
-  /// concept.
+  /// Requires result pointers to stay valid across appending new entries and
+  /// arbitrary erases (results are heap allocated behind unique_ptrs).
+  /// Provides the analysis ID to enable finding results for a given entry in
+  /// the map below, and provides the storage for the actual result concept.
   using AnalysisResultListT =
-      std::list<std::pair<AnalysisKey *, typename ResultConceptT::unique_ptr>>;
+      SmallVector<std::pair<AnalysisKey *, typename ResultConceptT::unique_ptr>,
+                  8>;
----------------
aengelke wrote:

Is this number empirically determined or just a guess?

Also, this is stored in the map IR->Results and so can be somewhat expensive to move when the map grows (bucket size should be 160B now, previously 40B). Still an improvement, but a rehash seems rather expensive. Can be improved later, though, although a quick test with a `unique_ptr<AnalysisResultListT>` could give some insights here.

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


More information about the llvm-commits mailing list