Use only_bind_out to force a good join order.#5851
Merged
Merged
Conversation
hvitved
reviewed
May 7, 2021
| result.getUnboundDeclaration() = | ||
| this.getASubsumedStaticTarget0(Gvn::getGlobalValueNumber(result.getDeclaringType())) | ||
| this.getASubsumedStaticTarget0(pragma[only_bind_out](Gvn::getGlobalValueNumber(result | ||
| .getDeclaringType()))) |
Contributor
There was a problem hiding this comment.
How about instead changing
cached
GvnType getGlobalValueNumber(Type t) { ... }to
cached
GvnType getGlobalValueNumberImpl(Type t) { ... }
pragma[inline]
GvnType getGlobalValueNumber(Type t) {
result = pragma[only_bind_out](getGlobalValueNumberImpl(t))
}in Unification.qll?
Contributor
Author
There was a problem hiding this comment.
That seems to break other code. Specifically typeConstraintUnifiable/typeConstraintSubsumes in Unification.qll where we rely on doing getGlobalValueNumber backwards and forcing the optimiser not to do that makes the code awful. It looks we avoid blowup in those cases due to how small TTypeConstraint is.
Contributor
There was a problem hiding this comment.
OK, let's get this in now, and then I can investigate the other approach in a follow-up PR.
hvitved
approved these changes
May 18, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This predicate changes to a bad join order with slight changes in the optimiser. By adding a
pragmahere we make it so that we avoid usingGvn::getGlobalValueNumberbackwards where possible.This makes it easier to make future optimiser changes which don't break this predicate.