-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[ARITH] Fix lowering of FloorMod #4236
Conversation
@@ -136,8 +136,7 @@ class IntrinInjecter : public arith::IRMutatorWithAnalyzer { | |||
|
|||
if (analyzer_->CanProveGreaterEqual(op->b, 0)) { | |||
// Common pass, positive divisor | |||
if (analyzer_->CanProveGreaterEqual(op->a, 0) || | |||
analyzer_->CanProveGreaterEqual(e, 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to keep the condition of e>=0, as it can sometimes imply a>=0 but we cannot directly prove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But floordiv(a, b) = e >= 0
always holds at this point (because b >= 0
, and floordiv is always non-negative in this case).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really, unless you meant floormod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I indeed meant floordmod (and we are in the FloorMod function).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok, sorry about that
Thanks @sgrechanik-h ! |
No description provided.