[llvm] [GenericCycle] Add a Cache for getExitBlocks in GenericCycle (PR #112290)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 17:07:39 PDT 2024


================
@@ -74,12 +74,16 @@ template <typename ContextT> class GenericCycle {
   ///       always have the same depth.
   unsigned Depth = 0;
 
+  /// Cache for the results of GetExitBlocks
+  std::unique_ptr<SmallVector<BlockT *, 4>> ExitBlocksCache;
----------------
Chengjunp wrote:

The reason I declare the cache as a pointer is that the `getExitBlocks` is a const function, so I cannot modify it (update the cache) in that function. This is a WAR of it. I can also try to make this as a mutable vector. 

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


More information about the llvm-commits mailing list