Skip to content

Use only_bind_out to force a good join order.#5851

Merged
alexet merged 1 commit into
mainfrom
alexet/patch
May 19, 2021
Merged

Use only_bind_out to force a good join order.#5851
alexet merged 1 commit into
mainfrom
alexet/patch

Conversation

@alexet

@alexet alexet commented May 7, 2021

Copy link
Copy Markdown
Contributor

This predicate changes to a bad join order with slight changes in the optimiser. By adding a pragma here we make it so that we avoid using Gvn::getGlobalValueNumber backwards where possible.This makes it easier to make future optimiser changes which don't break this predicate.

@alexet alexet requested a review from hvitved May 7, 2021 11:12
@alexet alexet requested a review from a team as a code owner May 7, 2021 11:12
@github-actions github-actions Bot added the C# label May 7, 2021
result.getUnboundDeclaration() =
this.getASubsumedStaticTarget0(Gvn::getGlobalValueNumber(result.getDeclaringType()))
this.getASubsumedStaticTarget0(pragma[only_bind_out](Gvn::getGlobalValueNumber(result
.getDeclaringType())))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, let's get this in now, and then I can investigate the other approach in a follow-up PR.

@alexet alexet added the no-change-note-required This PR does not need a change note label May 11, 2021
@alexet alexet merged commit c80495f into main May 19, 2021
@alexet alexet deleted the alexet/patch branch May 19, 2021 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C# no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants