[llvm] [NFC] CoroElide: Refactor `Lowerer` into `CoroIdElider` (PR #91539)

Yuxuan Chen via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 15:01:06 PDT 2024


================
@@ -287,91 +362,43 @@ bool Lowerer::shouldElide(Function *F, DominatorTree &DT) const {
   }
 
   // Filter out the coro.destroy that lie along exceptional paths.
-  SmallPtrSet<CoroBeginInst *, 8> ReferencedCoroBegins;
-  for (const auto &It : DestroyAddr) {
+  for (const auto *CB : CoroBegins) {
+    auto It = DestroyAddr.find(CB);
+
+    // FIXME: If we have not found any destroys for this coro.begin, we
+    // disqualify this elide.
+    if (It == DestroyAddr.end())
+      return false;
----------------
yuxuanchen1997 wrote:

This is not now. It has been an implicit condition in the old code because we are checking `CoroBegins.size()` against the ones we found references for. I feel like this immediate disqualification doesn't make sense to me. Maybe it should go to `CoroBeginCanEscape` instead. I am not changing this now as I want this patch to contain only nonfunctional changes. 

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


More information about the llvm-commits mailing list