diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -2576,6 +2576,7 @@ static void collectFrameAllocas(Function &F, coro::Shape &Shape, const SuspendCrossingInfo &Checker, SmallVectorImpl &Allocas) { + const DominatorTree DT(F); for (Instruction &I : instructions(F)) { auto *AI = dyn_cast(&I); if (!AI) @@ -2585,7 +2586,6 @@ if (AI == Shape.SwitchLowering.PromiseAlloca) { continue; } - DominatorTree DT(F); // The code that uses lifetime.start intrinsic does not work for functions // with loops without exit. Disable it on ABIs we know to generate such // code.