-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Remove self edges #13059
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
C++: Remove self edges #13059
Conversation
then preUpdate = [nFrom, getAPriorDefinition(defOrUse)] | ||
else preUpdate = nFrom | ||
) | ||
} |
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.
Can you explain what the change is here / why nodeFrom != nodeTo
above is insufficient on its own?
Otherwise LGTM.
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.
Sure. This was also my initial idea, but then @hvitved
pointed out that for flow out of post-update nodes specifically we need to allow SSA identity-steps. To see why, consider this example:
void setTaint(x) {
sink(x.field);
x.field = taint;
}
while (b) {
setTaint(y);
}
the flow after leaving setTaint
(i.e., from [post] y
) to y
is implemented as an SSA step from [post] y
's pre-update node (which is exactly y
) to the next use of y
, but the next use of y
is y
itself! So in order to have flow from [post] y
to y
the ssaFlow
predicate must include steps from y
to y
itself in order to support flow out of post-update nodes.
So the final creates a new postUpdateFlow
predicate whose implementation is equivalent to ssaFlow
, but allow identity steps.
Does that make sense?
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.
That makes sense, yep. Thanks for the explanation!
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.
👍
This removes all the cases of a dataflow node stepping to itself.
Commit-by-commit review recommended.