Skip to content

Simplify BNEInstr forms to eliminate non-identity comparisons #8189

@headius

Description

@headius

This came from #7588.

BNEInstr had a number of different paths to create, but it turns out all of them fall into these categories:

  • Comparison with true or false
  • Comparison with nil
  • Comparison with Undefined
  • Comparison with fixnum

The true/false cases have been replaced with construction of BTrueInstr and BFalse instr (flipped because this was BNE, nor BEQ). That leaves the other three cases.

For nil, there's BNilInstr for equality but nothing for inequality. Either that remains or we add a new BNotNilInstr or we flip branches using this form.

For Undefined, there's similarly BUndefInstr for equality but nothing for inequality.

The only fixnum cases are two uses of BNEInstr in flip-flop support to check the flip-flop gate status. They could also be implemented a different way.

In short, BNEInstr can be specialized to other forms and eliminated, or simplified to only have reference equality forms (nil and Undefined) moving the value equality uses to other instructions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions