diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index 58115fafbdf8e..ea2189b4af2b7 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -1865,6 +1865,8 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) { if (LdInst->getPointerOperandType() != LdInst->getType()) break; CurDef = LdInst->getPointerOperand(); + if (!isa(CurDef)) + break; DIs = FindDbgDeclareUses(CurDef); } }