If you compile a program with -Z no-landing-pads plus -C lto it is intended that all landing pads are removed. This does not happen on MSVC, however! A simple fn main() {} compiled with LTO will still have a bunch of invoke instructions lying around, even though they only call nounwind functions.
I believe this is due to this check. Our personality functions, __C_specific_handler and _except_handler3, can receive control flow from normal faults, so LLVM won't optimize away the invoke instructions.
Seems like we should use __CxxFrameHandler3 (the C++ personality function) if we can (or emulate it).
If you compile a program with
-Z no-landing-padsplus-C ltoit is intended that all landing pads are removed. This does not happen on MSVC, however! A simplefn main() {}compiled with LTO will still have a bunch ofinvokeinstructions lying around, even though they only callnounwindfunctions.I believe this is due to this check. Our personality functions,
__C_specific_handlerand_except_handler3, can receive control flow from normal faults, so LLVM won't optimize away theinvokeinstructions.Seems like we should use
__CxxFrameHandler3(the C++ personality function) if we can (or emulate it).