Skip to content

Remove > and >= comparisons from IR #7835

Open
@Kmeakin

Description

@Kmeakin

Feature

The condition codes for performing the > and >= comparisons on integers should be removed from the Cranelift IR

Benefit

Makes the IR more strongly normalizing. At the moment, there are two equivalent ways of specifying the same computation: x > y and y < x are semantically equivalent but have different representations in the IR.

Having only one possible representation would mean fewer cases to consider when writing lowering/optimization code, and fewer tests have to be performed at runtime when legalizing/optimizing programs.

Implementation

Continue to accept the sgt, sge, ugt and uge condition codes when consuming textual IR, but convert them to their swapped forms and swap the arguments to icmp during parsing. Update legalization/optimization code to fix any codegen regressions.

Alternatives

Do nothing

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions