[llvm] [coro][NFC] Move switch basic block to beginning of coroutine (PR #143626)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 15:59:15 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-coroutines

Author: Adrian Vogelsgesang (vogelsgesang)

<details>
<summary>Changes</summary>

This makes the code flow a bit more natural when reading the LLVM IR of a split coroutine. It does not change anything from an end-user perspective but makes debugging the CoroSplit pass slightly easier.

---
Full diff: https://github.com/llvm/llvm-project/pull/143626.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Coroutines/CoroSplit.cpp (+1) 


``````````diff
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index f9a6c70fedc2d..cebe44581b061 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -703,6 +703,7 @@ void coro::BaseCloner::replaceEntryBlock() {
     auto *SwitchBB =
         cast<BasicBlock>(VMap[Shape.SwitchLowering.ResumeEntryBlock]);
     Builder.CreateBr(SwitchBB);
+    SwitchBB->moveAfter(Entry);
     break;
   }
   case coro::ABI::Async:

``````````

</details>


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


More information about the llvm-commits mailing list