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

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 00:39:34 PDT 2025


Author: Adrian Vogelsgesang
Date: 2025-06-11T09:39:31+02:00
New Revision: 14c11e4bcb262496981a2948af11a3f9e9de23ef

URL: https://github.com/llvm/llvm-project/commit/14c11e4bcb262496981a2948af11a3f9e9de23ef
DIFF: https://github.com/llvm/llvm-project/commit/14c11e4bcb262496981a2948af11a3f9e9de23ef.diff

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

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

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/CoroSplit.cpp

Removed: 
    


################################################################################
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:


        


More information about the llvm-commits mailing list