-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Implement refinements for acyclic regions #179
Conversation
Currently, this just sticks the new nodes at the end, which almost certainly will break the topological ordering of the region.
7adba7b
to
d27f6f7
Compare
1c175d3
to
0ce108d
Compare
@sushant94 @chinmaydd @kriw please review |
I think @HMPerson1 is yet to complete 2 TODOs (or he can split them into another PR). |
Each condition now also stores its own negation so we can easily find the negation of an expression inside a different expression and simplify based on that.
c34add7
to
2d96736
Compare
@sushant94 This can be merged. |
@kriw would you like to take a look at this PR and help review it? |
@@ -0,0 +1,32 @@ | |||
#[derive(Debug, Eq, PartialEq)] | |||
pub enum AstNode<B, C, V> { |
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.
I would like you to leave comments what each B, C, V represents.
Cond(c, t, oe) => { | ||
let ot = simplify_ast_node::<A>(cctx, *t); | ||
let oe = oe.and_then(|e| simplify_ast_node::<A>(cctx, *e)); | ||
if c.is_true() { |
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.
match (c, t, oe) {
(c, _, _) if c.is_true() => ot,
(c, _, _) if c.is_false() => oe,
(c, Some(t), _) => Some(...),
(c, _, Some(e), _) => Some(...),
_ => None
}
would shorten the code.
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.
The c.is_true/false
can't be in a match because by-move patterns can't have pattern guards, but the last part is indeed cleaner. Thanks!
LGTM :) |
Merging. Thanks all! |
if-then-else
if-then
sCondition-aware refinementsPostponed until Fold conditional flags into original ones #171 is done