Skip to content

arith: replace string predicates with CmpIPredicate enums in ArithVal… - #707

Open
viniciusfdasilva wants to merge 1 commit into
llvm:mainfrom
viniciusfdasilva:main
Open

viniciusfdasilva wants to merge 1 commit into
llvm:mainfrom
viniciusfdasilva:main

Conversation

@viniciusfdasilva

Copy link
Copy Markdown

This PR refactors ArithValue's comparison operators to dispatch on CmpIPredicate enum members instead of ad-hoc strings, removing the string-based predicate mini-language while preserving existing signed/unsigned and int/float resolution behavior.

Resolves #230

@makslevental
makslevental self-requested a review September 25, 2026 02:42


canonicalizer = ArithCanonicalizer()
canonicalizer = ArithCanonicalizer() No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you restore the newline here

if isinstance(lhs.dtype, FloatType):
# ordered comparison - see above
predicate = "o" + predicate
enum_predicate = _CMPF_PREDICATES[predicate][0]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enum_predicate = _CMPF_PREDICATES[predicate][0]
enum_predicate, _ = _CMPF_PREDICATES[predicate]

@makslevental makslevental left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you have some issues

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TODO] migrate ArithValue to use cmp enums themselves instead of strings.

2 participants