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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 21:15:51 PDT 2024


================
@@ -124,7 +141,12 @@ template <typename ContextT> class GenericCycle {
   bool contains(const GenericCycle *C) const;
 
   const GenericCycle *getParentCycle() const { return ParentCycle; }
-  GenericCycle *getParentCycle() { return ParentCycle; }
+
+  GenericCycle *getParentCycle() {
+    clearCache();
+    return ParentCycle;
+  }
----------------
arsenm wrote:

Clearing the cache in a getter (and only the non-const one) seems dubious

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


More information about the llvm-commits mailing list