[PATCH] D114543: Extend the `uwtable` attribute with unwind table kind
Momchil Velikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 24 10:16:00 PST 2021
chill created this revision.
chill added reviewers: t.p.northover, efriedma, MaskRay.
Herald added subscribers: dexonsmith, okura, jdoerfert, kuter, hiraditya, kristof.beyls, arichardson.
chill requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
We have the `clang -cc1` command-line option `-funwind-tables=1|2` and
the codegen option `VALUE_CODEGENOPT(UnwindTables, 2, 0) ///< Unwind
tables (1) or asynchronous unwind tables (2)`. However, this is
encoded in LLVM IR by the presence or the absence of the `uwtable`
attribute, i.e. we lose the information whether to generate want just
some unwind tables or asynchronous unwind tables.
Asynchronous unwind tables take more space in the runtime image, I'd
estimate something like 80-90% more, as the difference is adding
roughly the same number of CFI directives as for prologues, only a bit
simpler (e.g. `.cfi_offset reg, off` vs. `.cfi_restore reg`). Or even
more, if you consider tail duplication of epilogue blocks.
Asynchronous unwind tables could also restrict code generation to
having only a finite number of frame pointer adjustments (an example
of *not* having a finite number of `SP` adjustments is on AArch64 when
untagging the stack (MTE) in some cases the compiler can modify `SP`
in a loop).
Having the CFI precise up to an instruction generally also means one
cannot bundle together CFI instructions once the prologue is done,
they need to be interspersed with ordinary instructions, which means
extra `DW_CFA_advance_loc` commands, further increasing the unwind
tables size.
That is to say, async unwind tables impose a non-negligible overhead,
yet for the most common use cases (like C++ exceptions), they are not
even needed.
This patch extends the `uwtable` attribute with an optional
value:
- `uwtable` (default to 2)
- `uwtable(1)`, sync unwind tables
- `uwtable(2)`, async unwind tables
https://reviews.llvm.org/D114543
Files:
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/asan-globals.cpp
clang/test/CodeGen/uwtable-attr.c
llvm/docs/LangRef.rst
llvm/include/llvm/AsmParser/LLParser.h
llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/IR/Attributes.td
llvm/include/llvm/IR/Function.h
llvm/include/llvm/IR/Module.h
llvm/include/llvm/Support/CodeGen.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/CodeGen/MachineOutliner.cpp
llvm/lib/IR/AttributeImpl.h
llvm/lib/IR/Attributes.cpp
llvm/lib/IR/Function.cpp
llvm/lib/IR/Module.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/test/Bitcode/attributes.ll
llvm/test/Instrumentation/AddressSanitizer/module-flags.ll
llvm/test/Transforms/Attributor/ArgumentPromotion/X86/attributes.ll
llvm/test/Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll
llvm/test/Transforms/Attributor/align.ll
llvm/test/Transforms/Attributor/allow_list.ll
llvm/test/Transforms/Attributor/cb_liveness_disabled.ll
llvm/test/Transforms/Attributor/cb_liveness_enabled.ll
llvm/test/Transforms/Attributor/internal-noalias.ll
llvm/test/Transforms/Attributor/liveness.ll
llvm/test/Transforms/Attributor/nocapture-2.ll
llvm/test/Transforms/Attributor/nofree.ll
llvm/test/Transforms/Attributor/noreturn.ll
llvm/test/Transforms/Attributor/nosync.ll
llvm/test/Transforms/Attributor/returned.ll
llvm/test/Transforms/Attributor/willreturn.ll
llvm/test/Transforms/FunctionAttrs/atomic.ll
llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
llvm/test/Transforms/FunctionAttrs/nofree.ll
llvm/test/Transforms/FunctionAttrs/nosync.ll
llvm/test/Transforms/GCOVProfiling/module-flags.ll
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
llvm/unittests/IR/VerifierTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114543.389530.patch
Type: text/x-patch
Size: 193092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211124/4d18ef5c/attachment-0001.bin>
More information about the llvm-commits
mailing list