From 340074743b121d951eae857d319081f32cd12c04 Mon Sep 17 00:00:00 2001 From: Adrian Vogelsgesang Date: Tue, 10 Jun 2025 21:34:46 +0000 Subject: [PATCH] [coro][NFC] Move switch basic block towards beginning of coroutine 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. --- llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 1 + 1 file changed, 1 insertion(+) 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(VMap[Shape.SwitchLowering.ResumeEntryBlock]); Builder.CreateBr(SwitchBB); + SwitchBB->moveAfter(Entry); break; } case coro::ABI::Async: