This is an archive of the discontinued LLVM Phabricator instance.

WIP: Unwindabort: Implement CodeGen for DWARF-style exception handling.
Needs ReviewPublic

Authored by jyknight on Jan 17 2023, 3:53 AM.
This revision needs review, but there are no reviewers specified.



This change causes 'call unwindabort' to emit EH_LABELs and add them
to the list of EH regions, in both SelectionDAG and GlobalISel.

It also adjusts the DWARF "resume" lowering to lower "resume
unwindabort" to "call unwindabort" appropriately.

The actual LSDA callsite table emission did not require any changes:
it already worked as desired. Test-cases were added, however.

This does not yet implement support for the other varieties of
exception-handling supported by LLVM:

  • Windows funclets
  • WebAssembly
  • setjmp/longjmp

TODO: currently basic-block-sections are broken, as they have a
pre-existing flaw: they emit invalid unwind tables, where the callsite
table size is larger than it should be. The assumption in the initial
commit was that this was a harmless lie: that the unwinder would never
notice the garbage after the callsites, because the prior entries
would cover the whole function. That was not _necessarily_ the case
before, but is definitely not the case now.

Depends on D141916

Diff Detail

Unit TestsFailed

Event Timeline

jyknight created this revision.Jan 17 2023, 3:53 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 17 2023, 3:53 AM
jyknight requested review of this revision.Jan 17 2023, 3:53 AM
modimo added a subscriber: modimo.Jan 17 2023, 2:02 PM
jroelofs added inline comments.

no else after return?

jyknight updated this revision to Diff 546612.Aug 2 2023, 2:23 PM
jyknight edited the summary of this revision. (Show Details)

Rebase patch.

jyknight added inline comments.Aug 10 2023, 11:57 AM

The else is for CI.isInlineAsm(), so correct as is. Might be easier to read formatted like this?

if (CI.isInlineAsm()) {
  if (!translateInlineAsm(CI, MIRBuilder))
    return false;
} else {
  if (!translateCallBase(CI, MIRBuilder))
    return false;
jroelofs added inline comments.Aug 10 2023, 1:52 PM

I realize now that what I was suggesting wasn't correct. No preference, now that I understand my mistake.