[BOLT] Support split landing pad
authorHuan Nguyen <nhuhuan@yahoo.com>
Fri, 15 Jul 2022 01:04:58 +0000 (18:04 -0700)
committerHuan Nguyen <nhuhuan@yahoo.com>
Fri, 15 Jul 2022 01:10:22 +0000 (18:10 -0700)
commitae563c914655ed4535f13f1e01c5cb482130e909
tree2e98a3e33b362e0b6609d050542ed965969c6aac
parent33aa374e597260dae739bb949892cff31ae31eb9
[BOLT] Support split landing pad

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

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D128561
bolt/lib/Core/Exceptions.cpp
bolt/lib/Rewrite/RewriteInstance.cpp
bolt/test/X86/split-landing-pad.s [new file with mode: 0644]