Skip to content

Commit

Permalink
[DwarfEhPrepare] Assign dummy debug location for more inserted _Unwin…
Browse files Browse the repository at this point in the history
…d_Resume calls (llvm#105513)

Similar to the fix for llvm#57469, ensure that the other `_Unwind_Resume`
call emitted by DwarfEHPrepare has a debug location if needed.

This fixes nbdd0121/unwinding#34.

(cherry picked from commit e76db25)
  • Loading branch information
sunfishcode authored and tru committed Aug 26, 2024
1 parent cfe8eb8 commit 5f744ee
Show file tree
Hide file tree
Showing 2 changed files with 1,182 additions and 0 deletions.
7 changes: 7 additions & 0 deletions llvm/lib/CodeGen/DwarfEHPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls() {
// Call the function.
CallInst *CI =
CallInst::Create(RewindFunction, RewindFunctionArgs, "", UnwindBB);
// The verifier requires that all calls of debug-info-bearing functions
// from debug-info-bearing functions have a debug location (for inlining
// purposes). Assign a dummy location to satisfy the constraint.
Function *RewindFn = dyn_cast<Function>(RewindFunction.getCallee());
if (RewindFn && RewindFn->getSubprogram())
if (DISubprogram *SP = F.getSubprogram())
CI->setDebugLoc(DILocation::get(SP->getContext(), 0, 0, SP));
CI->setCallingConv(RewindFunctionCallingConv);

// We never expect _Unwind_Resume to return.
Expand Down
Loading

0 comments on commit 5f744ee

Please sign in to comment.