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

[CIR] Add Case Op Kind Range #650

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

wenpen
Copy link
Contributor

@wenpen wenpen commented Jun 2, 2024

Make lowering result of case range smart.

Resolve #632

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for improving this, one minor comment inline and I'll merge this.

FWIW, some cool small optimizations ideas to work in future PRs:

  • Recognize ranges that all fallthrough to the same block and transform it to just one range (e.g. the testcase in sw1).
  • Recognize anyofs in which elements are monotonic and convert those to a range.

One way to implement this is to add a SwitchOp::fold method, and add SwitchOp to the list of patterns in MergeCleanups.cpp.

@wenpen
Copy link
Contributor Author

wenpen commented Jun 4, 2024

Comments added, thanks for pointing out the future works!

@bcardosolopes bcardosolopes merged commit 4200ad0 into llvm:main Jun 5, 2024
6 checks passed
bruteforceboy pushed a commit to bruteforceboy/clangir that referenced this pull request Oct 2, 2024
Make lowering result of case range smart.

Resolve llvm#632
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
Make lowering result of case range smart.

Resolve llvm#632
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Make lowering result of case range smart.

Resolve llvm#632
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
Make lowering result of case range smart.

Resolve llvm#632
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.

Case gnu range need to be improved
2 participants