This is an archive of the discontinued LLVM Phabricator instance.

WIP: Unwindabort: Add "unwindabort" syntax for the "call" instruction.
Needs ReviewPublic

Authored by jyknight on Jan 17 2023, 3:53 AM.

Details

Reviewers
t.p.northover
Summary

This is part of a series of changes to enable generating more
efficient code for C++ "noexcept" functions. See also the RFC,
https://discourse.llvm.org/t/rfc-add-call-unwindabort-to-llvm-ir/62543

The 'unwindabort' modifier specifies that if the call stack is unwound
due to an exception, the personality function should abort the process
instead of continuing to unwind to the caller.

This commit adds only the core textual and bitcode IR parsing/writing
for the 'call' instruction.

Diff Detail

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
lebedev.ri added inline comments.
llvm/test/Verifier/unwindabort-personality.ll
9

Need similar check for the cannot use musttail with unwindabort

I guess this should exposed via LLVM C API.

jroelofs added inline comments.
llvm/docs/ExceptionHandling.rst
307

suggest: s/This flag/The presence of this flag/

309
llvm/docs/LangRef.rst
12103

Maybe I missed it in the Discourse thread, but can you elaborate on why musttail and unwindabort are mutually exclusive?

llvm/include/llvm/Bitcode/LLVMBitCodes.h
531

Trailing comma makes this nicer for the next addition to the list.

llvm/lib/IR/Verifier.cpp
3844–3848

I think this deserves an entry in llvm/utils/vim/syntax/llvm.vim under keywords.

jroelofs added inline comments.Jul 26 2023, 5:23 PM
llvm/docs/LangRef.rst
12103

Oh, I see this is answered in a comment in a later patch:

// A call marked unwindabort cannot be tail called, because the unwinder must
// examine the call frame.

Probably worth sticking some or all of that note here.

jroelofs added inline comments.Jul 28 2023, 10:00 AM
llvm/docs/LangRef.rst
12134
jyknight updated this revision to Diff 546607.Aug 2 2023, 2:22 PM
jyknight marked an inline comment as done.
jyknight edited the summary of this revision. (Show Details)

Rebase patch.

jyknight marked 7 inline comments as done.Aug 10 2023, 11:51 AM

I guess this should exposed via LLVM C API.

Adding a new patch to the series for this.

I think this deserves an entry in llvm/utils/vim/syntax/llvm.vim under keywords.

Done. Also emacs/llvm-mode.el.

llvm/test/Verifier/unwindabort-personality.ll
9

That test (musttail-invalid.ll) had been previously added to the wrong commit in this series. Corrected.