[llvm] CycleInfo: Fix splitCriticalEdge (PR #68584)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 9 21:46:29 PDT 2023


================
@@ -392,6 +390,36 @@ auto GenericCycleInfo<ContextT>::getCycle(const BlockT *Block) const
   return BlockMap.lookup(Block);
 }
 
+/// \brief Find the innermost cycle containing both given blocks.
+///
+/// \returns the innermost cycle containing both \p A and \p B or nullptr if
+///          they are not both contained in any cycle.
+template <typename ContextT>
+auto GenericCycleInfo<ContextT>::getSmallestCommonCycle(const BlockT *A,
+                                                        const BlockT *B) const
+    -> CycleT * {
----------------
ssahasra wrote:

This should take cycles as arguments. It is more likely that the client has already located the cycles for A and B, so we can avoid the calls to getCycle() inside this function.

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


More information about the llvm-commits mailing list