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

[Opt] Algebraic simplification for binary operations with two operands having the same value #2111

Merged
merged 2 commits into from
Dec 22, 2020

Conversation

xumingkuan
Copy link
Contributor

@xumingkuan xumingkuan commented Dec 21, 2020

Related issue = #656 #2106 (comment)

plot20201221

New peephole optimizations in this PR:

  • a - a -> 0 (fast math)
  • a or a -> a
  • a xor a -> 0
  • a / a -> 1 (fast math)
  • a and a -> a
  • a == a -> 1 (fast math)
  • a >= a -> 1 (fast math)
  • a <= a -> 1 (fast math)
  • a != a -> 0 (fast math)
  • a > a -> 0 (fast math)
  • a < a -> 0 (fast math)

Also fixes check_out_of_bound not assigning the types to the newly inserted statements.

[Click here for the format server]


Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

Awesome, LGTM! Thanks!

@yuanming-hu yuanming-hu merged commit 7779f35 into taichi-dev:master Dec 22, 2020
@k-ye k-ye mentioned this pull request Jan 5, 2021
@xumingkuan xumingkuan deleted the simp-eq branch March 13, 2021 12:17
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.

2 participants