Skip to content

Different codegen between comparison of &str and &[u8] on And and Or condition #144279

@CrazyboyQCD

Description

@CrazyboyQCD

On And condition, &[u8] can be optimized directly as false while &str can't
https://godbolt.org/z/GvWxGxj5b

On Or condition, &[u8] generates more branches/comparisons than &str
https://godbolt.org/z/EcYa99658

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions