[llvm] [Coroutines] Refactor CoroShape::buildFrom for future use by ABI objects (PR #108623)

Chuanqi Xu via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 19:29:19 PDT 2024


================
@@ -298,8 +286,58 @@ void coro::Shape::buildFrom(Function &F) {
     }
   }
 
-  // If for some reason, we were not able to find coro.begin, bailout.
-  if (!CoroBegin) {
+  // If there is no CoroBegin then this is not a coroutine.
+  if (!CoroBegin)
+    return;
+
+  // Determination of ABI and initializing lowering info
+  auto Id = CoroBegin->getId();
+  auto IntrID = Id->getIntrinsicID();
+  if (IntrID == Intrinsic::coro_id) {
----------------
ChuanqiXu9 wrote:

Let's following the original style to use switch.

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


More information about the llvm-commits mailing list