@@ -2003,21 +2003,25 @@ void IRGenDebugInfoImpl::emitDbgIntrinsic(
2003
2003
return ;
2004
2004
2005
2005
// A dbg.declare is only meaningful if there is a single alloca for
2006
- // the variable that is live throughout the function. With SIL
2007
- // optimizations this is not guaranteed and a variable can end up in
2008
- // two allocas (for example, one function inlined twice).
2006
+ // the variable that is live throughout the function.
2009
2007
if (auto *Alloca = dyn_cast<llvm::AllocaInst>(Storage)) {
2010
2008
auto *ParentBB = Alloca->getParent ();
2011
2009
auto InsertBefore = std::next (Alloca->getIterator ());
2012
2010
if (InsertBefore != ParentBB->end ())
2013
2011
DBuilder.insertDeclare (Alloca, Var, Expr, DL, &*InsertBefore);
2014
2012
else
2015
2013
DBuilder.insertDeclare (Alloca, Var, Expr, DL, ParentBB);
2016
- return ;
2014
+ } else if (isa<llvm::IntrinsicInst>(Storage) &&
2015
+ cast<llvm::IntrinsicInst>(Storage)->getIntrinsicID () ==
2016
+ llvm::Intrinsic::coro_alloca_get) {
2017
+ // FIXME: The live range of a coroutine alloca within the function may be
2018
+ // limited, so using a dbg.addr instead of a dbg.declare would be more
2019
+ // appropriate.
2020
+ DBuilder.insertDeclare (Storage, Var, Expr, DL, BB);
2021
+ } else {
2022
+ // Insert a dbg.value at the current insertion point.
2023
+ DBuilder.insertDbgValueIntrinsic (Storage, Var, Expr, DL, BB);
2017
2024
}
2018
-
2019
- // Insert a dbg.value at the current insertion point.
2020
- DBuilder.insertDbgValueIntrinsic (Storage, Var, Expr, DL, BB);
2021
2025
}
2022
2026
2023
2027
void IRGenDebugInfoImpl::emitGlobalVariableDeclaration (
0 commit comments