Clean up the logic in IREquality.