Skip to content

MSVC: LTO plus -Z no-landing-pads leaves landing pads #33116

Closed
@alexcrichton

Description

@alexcrichton

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.O-windows-msvcToolchain: MSVC, Operating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions