diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index 38089857f0475..633c7ee7ff63d 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -1863,6 +1863,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); } }