Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dialects: (arith) select canonicalization patterns #3368

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

alexarice
Copy link
Collaborator

Adds some simple canonicalization patterns for arith.select

@alexarice alexarice self-assigned this Oct 31, 2024
@alexarice alexarice added dialects Changes on the dialects transformations Changes or adds a transformatio labels Oct 31, 2024
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.10%. Comparing base (a0d3757) to head (fb761d1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3368      +/-   ##
==========================================
- Coverage   90.10%   90.10%   -0.01%     
==========================================
  Files         449      449              
  Lines       56686    56719      +33     
  Branches     5443     5451       +8     
==========================================
+ Hits        51079    51107      +28     
- Misses       4168     4170       +2     
- Partials     1439     1442       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alexarice
Copy link
Collaborator Author

I'll merge after #3362 and #3364 to avoid conflicts

Comment on lines +42 to +129
arith.select %x %true %false = %x
arith.select %x %false %true = %x xor 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

For an i1 result type you may even consider folding the %true %true and %false %false cases if you think they may realistically come up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

More generally, arith.select %x %y %y should be %y right? I realise I didn't include this as I didn't immediately find it in mlir but it would probably be nice to add

@alexarice
Copy link
Collaborator Author

Added select x y y = y and rebased

@alexarice alexarice merged commit 656457a into main Oct 31, 2024
14 checks passed
@alexarice alexarice deleted the alexarice/select-canon branch October 31, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialects Changes on the dialects transformations Changes or adds a transformatio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants