Skip to content

Commit 5f744ee

Browse files
sunfishcodetru
authored andcommitted
[DwarfEhPrepare] Assign dummy debug location for more inserted _Unwind_Resume calls (#105513)
Similar to the fix for #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)
1 parent cfe8eb8 commit 5f744ee

File tree

2 files changed

+1182
-0
lines changed

2 files changed

+1182
-0
lines changed

llvm/lib/CodeGen/DwarfEHPrepare.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,13 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls() {
293293
// Call the function.
294294
CallInst *CI =
295295
CallInst::Create(RewindFunction, RewindFunctionArgs, "", UnwindBB);
296+
// The verifier requires that all calls of debug-info-bearing functions
297+
// from debug-info-bearing functions have a debug location (for inlining
298+
// purposes). Assign a dummy location to satisfy the constraint.
299+
Function *RewindFn = dyn_cast<Function>(RewindFunction.getCallee());
300+
if (RewindFn && RewindFn->getSubprogram())
301+
if (DISubprogram *SP = F.getSubprogram())
302+
CI->setDebugLoc(DILocation::get(SP->getContext(), 0, 0, SP));
296303
CI->setCallingConv(RewindFunctionCallingConv);
297304

298305
// We never expect _Unwind_Resume to return.

0 commit comments

Comments
 (0)