Skip to content

Missed optimization: equivalent expressions generate different assembly with extra load #142765

Open
@gh228df

Description

@gh228df

The Clang optimizer fails to generate equally efficient assembly for semantically equivalent expressions. The function sub_bytes() produces less optimal code than its logically equivalent counterpart sub_bytes_alt() or a version manually restructured to match optimized assembly.

Clang should recognize the algebraic equivalence of the expressions in sub_bytes() and optimize them the same way it does for sub_bytes_alt() or sub_bytes_asm().


Compiler Explorer: https://godbolt.org/z/rscej9nds

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions