This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Support split landing pad
ClosedPublic

Authored by nhuhuan on Jun 24 2022, 4:16 PM.

Details

Summary

We previously support split jump table, where some jump table entries
target different fragments of same function. In this fix, we provide
support for another type of intra-indirect transfer: landing pad.

When C++ exception handling is used, compiler emits .gcc_except_table
that describes the location of catch block (landing pad) for specific
range that potentially invokes a throw(). Normally landing pads reside
in the function, but with -fsplit-machine-functions, landing pads can
be moved to another fragment. The intuition is, landing pads are rarely
executed, so compiler can move them to .cold section.

This update will mark all fragments that have landing pad to another
fragment as non-simple, and later propagate non-simple to all related
fragments.

This update also includes one manual test case: split-landing-pad.s

Diff Detail

Event Timeline

nhuhuan created this revision.Jun 24 2022, 4:16 PM
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: ayermolo. · View Herald Transcript
nhuhuan requested review of this revision.Jun 24 2022, 4:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2022, 4:16 PM
nhuhuan updated this revision to Diff 439924.Jun 24 2022, 4:40 PM

Clang-formatted. Remove some unnecessary metadata.

Rename typo in title BOTL -> BOLT

nhuhuan retitled this revision from [BOTL] Support split landing pad to [BOLT] Support split landing pad.Jun 24 2022, 6:09 PM
Amir added inline comments.Jun 27 2022, 9:45 PM
bolt/test/X86/split-landing-pad.s
2

Please add a comment about the source C++ and how the assembly was produced, similar to https://reviews.llvm.org/D128696 bolt/test/runtime/X86/Inputs/pie-exceptions-failed-split.s

nhuhuan updated this revision to Diff 442147.Jul 4 2022, 2:41 PM

In this update:

  • Support DW_EH_PE_absptr encoding.
  • Add comments on how this test was written.
nhuhuan marked an inline comment as done.Jul 4 2022, 2:42 PM
nhuhuan added inline comments.
bolt/test/X86/split-landing-pad.s
2

The test was enhanced with detailed steps on how this test was written.

nhuhuan updated this revision to Diff 442153.Jul 4 2022, 4:42 PM

In this update:

  • Fix a bug related to landing pad in builtin_unreachable.
  • Add an assert that landing pad must be in an identified function.
nhuhuan updated this revision to Diff 442156.Jul 4 2022, 5:23 PM

Fix incorrect condition in assertion

Amir accepted this revision.Jul 12 2022, 2:21 PM
This revision is now accepted and ready to land.Jul 12 2022, 2:21 PM
Amir requested changes to this revision.Jul 14 2022, 11:44 AM

The commit needs to be amended after a rebase:

/var/lib/buildkite-agent/builds/llvm-project/bolt/lib/Core/Exceptions.cpp:188:7: error: use of undeclared identifier 'InterproceduralReferences'
This revision now requires changes to proceed.Jul 14 2022, 11:44 AM
nhuhuan updated this revision to Diff 444798.Jul 14 2022, 2:24 PM

Rebase and fix conflicts.

Amir accepted this revision.Jul 14 2022, 6:05 PM
This revision is now accepted and ready to land.Jul 14 2022, 6:05 PM
This revision was automatically updated to reflect the committed changes.