Skip to content

Option<bool>::eq optimizes poorly #139078

Closed as duplicate of#122734
Closed as duplicate of#122734
@scottmcm

Description

@scottmcm

Option<bool>::eq is ~20 lines of assembly as of rustc 1.87.0-nightly (a2e63569f 2025-03-26).

Repro: https://rust.godbolt.org/z/hPn8TvvYP

This is here to track this FIXME:

// FIXME: This should work too
// // FIXME-CHECK-LABEL: @bool_eq
// #[no_mangle]
// pub fn bool_eq(l: Option<bool>, r: Option<bool>) -> bool {
// // FIXME-CHECK: start:
// // FIXME-CHECK-NEXT: icmp eq i8
// // FIXME-CHECK-NEXT: ret i1
// l == r
// }

With llvm/llvm-project#133344 fixed upstream (thanks @veera-sivarajan for jumping on it so quickly!) after the LLVM 21 version upgrade we should revisit this and see whether we can enable that test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-heavyIssue: Problems and improvements with respect to binary size of generated code.S-blockedStatus: Blocked on something else such as an RFC or other implementation work.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions