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

egraphs: Canonicalize loose inequalities to strict inequalities (2nd attempt) #9040

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Kmeakin
Copy link
Contributor

@Kmeakin Kmeakin commented Jul 29, 2024

A 2nd attempt at #6130. This time with a regression test

@Kmeakin Kmeakin requested a review from a team as a code owner July 29, 2024 19:11
@Kmeakin Kmeakin requested review from elliottt and removed request for a team July 29, 2024 19:11
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language labels Jul 29, 2024
Copy link

Subscribe to Label Action

cc @cfallin, @fitzgen

This issue or pull request has been labeled: "cranelift", "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@Kmeakin Kmeakin force-pushed the km/loose-inequalities-to-strict-inequalities-v2 branch from b6aa954 to 5f9b182 Compare July 30, 2024 09:46
@Kmeakin Kmeakin requested a review from a team as a code owner July 30, 2024 09:46
Comment on lines 84 to 88
;; FIXME: triggers verifier error
;; sge(x, c) == sgt(x, c-1), for c != SMIN.
;; (rule (simplify (sge (fits_in_64 (ty_int bty)) x (iconst cty (u64_from_imm64 c))))
;; (if-let $false (u64_eq c (ty_smin cty)))
;; (sgt bty x (iconst cty (imm64 (u64_sub c 1)))))

Copy link
Member

Choose a reason for hiding this comment

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

Is the main difference to #6130 this commented out rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link
Member

Choose a reason for hiding this comment

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

Would you mind adding a comment explaining why this is currently commented out? With that added, I think this should be good to merge 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it has been fixed by 0683b84

Copy link
Member

Choose a reason for hiding this comment

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

Should it be un-commented now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was wrong. I thought it had been fixed, but that was just because I forgot to uncomment it

@Kmeakin Kmeakin force-pushed the km/loose-inequalities-to-strict-inequalities-v2 branch 2 times, most recently from 8a4ec40 to c82d978 Compare August 5, 2024 23:11
Add a regression test for issue bytecodealliance#6185. PR bytecodealliance#6130 will be re-applied in
next commit.

Copyright (c) 2024, Arm Limited.

Signed-off-by: Karl Meakin <karl.meakin@arm.com>
Canonicalize `icmp` instructions:
* loose inequalities to strict inequalities (eg `ult(x, c) => ult(x,
  c+1)`) where possible
* strict inequalities to equalities (eg `ult(x, 1) => eq(x, 0)`) where
  possible

Copyright (c) 2024, Arm Limited.

Signed-off-by: Karl Meakin <karl.meakin@arm.com>
@Kmeakin Kmeakin force-pushed the km/loose-inequalities-to-strict-inequalities-v2 branch from c82d978 to 978e7e6 Compare August 5, 2024 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants