[llvm] Reapply "[coro][CoroSplit] Use `llvm.lifetime.end` to compute putting objects on the frame vs the stack (#90265) (PR #91372)

Alan Zhao via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 19:32:27 PDT 2024


================
@@ -130,14 +130,35 @@ static const Loop *getOutermostLoop(const LoopInfo *LI, const BasicBlock *BB) {
   return L ? L->getOutermostLoop() : nullptr;
 }
 
-bool llvm::isPotentiallyReachableFromMany(
-    SmallVectorImpl<BasicBlock *> &Worklist, const BasicBlock *StopBB,
-    const SmallPtrSetImpl<BasicBlock *> *ExclusionSet, const DominatorTree *DT,
-    const LoopInfo *LI) {
-  // When the stop block is unreachable, it's dominated from everywhere,
+template <class T, bool IsMany>
+static bool isReachableImpl(SmallVectorImpl<BasicBlock *> &Worklist,
+                            const T *StopBBOrSet,
+                            const SmallPtrSetImpl<BasicBlock *> *ExclusionSet,
+                            const DominatorTree *DT, const LoopInfo *LI) {
+  const BasicBlock *StopBB;
+  const SmallPtrSetImpl<const BasicBlock *> *StopSet;
----------------
alanzhao1 wrote:

The class naming is kinda backwards and confusing - `SmallPtrSet` inherts **from** `SmallPtrSetImpl`, not the other way around.

`SmallPtrSet` has an `int SmallSize` template parameter, so by using the base class, we don't restrict the size of the passed `SmallPtrSet`.

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


More information about the llvm-commits mailing list