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 @@ -2609,6 +2609,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) @@ -2618,7 +2619,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.