This is an archive of the discontinued LLVM Phabricator instance.

[DwarfEhPrepare] Assign dummy debug location for inserted _Unwind_Resume calls (PR57469)
ClosedPublic

Authored by nikic on Sep 1 2022, 1:19 AM.

Details

Summary

DwarfEhPrepare inserts calls to _Unwind_Resume into landing pads. If _Unwind_Resume happens to be defined in the same module and debug info is used, then this leads to a verifier error:

inlinable function call in a function with debug info must have a !dbg location
  call void @_Unwind_Resume(ptr %exn.obj) #0

Fix this by assigning a dummy location to the call. (As this happens in the backend, inlining is not actually relevant here.)

Fixes https://github.com/llvm/llvm-project/issues/57469.

Diff Detail

Event Timeline

nikic created this revision.Sep 1 2022, 1:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2022, 1:19 AM
nikic requested review of this revision.Sep 1 2022, 1:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2022, 1:19 AM
jmorse accepted this revision.Sep 1 2022, 3:31 AM
jmorse added a subscriber: jmorse.

LGTM with one small maintainability nit.

llvm/test/CodeGen/X86/dwarf-eh-prepare-dbg.ll
64

Having "!12" in the CHECK line is liable to future breakage if the metadata re-orders / upgrades / otherwise alters -- please instead capture the DISubprogram's node number and check against that.

This revision is now accepted and ready to land.Sep 1 2022, 3:31 AM
This revision was landed with ongoing or failed builds.Sep 1 2022, 7:36 AM
This revision was automatically updated to reflect the committed changes.