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

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 21:29:39 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;
+  }
----------------
ssahasra wrote:

Yeah, clearly there is no change in state here and we don't need to clear the cache. At least this one is obvious enough. We could later revisit other non-const functions too, maybe as a future enhancement.

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


More information about the llvm-commits mailing list