Skip to content

Commit f198658

Browse files
Merge pull request #2284 from adrian-prantl/72867671
salvageDebugInfo returns a nullptr to signal errors. Handle this case
2 parents 3e472be + 12f26cb commit f198658

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,6 +1653,7 @@ void coro::salvageDebugInfo(
16531653
++InsertPt;
16541654
Builder.SetInsertPoint(&F->getEntryBlock(), InsertPt);
16551655
DIExpression *Expr = DDI->getExpression();
1656+
assert(Expr && "null DIExpression");
16561657
// Follow the pointer arithmetic all the way to the incoming
16571658
// function argument and convert into a DIExpression.
16581659
Value *Storage = DDI->getAddress();
@@ -1662,6 +1663,9 @@ void coro::salvageDebugInfo(
16621663
} else if (auto *GEPInst = dyn_cast<GetElementPtrInst>(Storage)) {
16631664
Expr = llvm::salvageDebugInfoImpl(*GEPInst, Expr,
16641665
/*WithStackValue=*/false);
1666+
// Bail out if the expression couldn't be salvaged.
1667+
if (!Expr)
1668+
return;
16651669
Storage = GEPInst->getOperand(0);
16661670
} else if (auto *BCInst = dyn_cast<llvm::BitCastInst>(Storage))
16671671
Storage = BCInst->getOperand(0);

0 commit comments

Comments
 (0)