Merged
Conversation
Before
```
Pipeline standard for TypeInference::MethodCallMatching::AccessConstraint::RelevantAccess.getTypeAt/1#dispred#e8abf748@ada3a07w was evaluated in 801 iterations totaling 31ms (delta sizes total: 182871).
50151 ~1% {4} r1 = SCAN TypeInference::MethodCallMatching::AccessConstraint::MkRelevantAccess#7a01048b#prev_delta OUTPUT In.0, In.2, In.3, In.4
39574 ~0% {5} | JOIN WITH `TypeInference::MethodCallMatchingInput::Access.getInferredNonSelfType/2#dispred#b181cb0a#prev` ON FIRST 2 OUTPUT Lhs.3, Rhs.3, _, Lhs.2, Rhs.2
{3} | REWRITE WITH Tmp.2 := "", Out.2 := InverseAppend(In.3,Tmp.2,In.4) KEEPING 3
36996 ~0% {3} | SCAN OUTPUT In.0, In.2, In.1
36102333 ~0% {4} r2 = SCAN TypeInference::MethodCallMatching::AccessConstraint::MkRelevantAccess#7a01048b#prev OUTPUT In.0, In.2, In.3, In.4
90175 ~1% {5} | JOIN WITH `TypeInference::MethodCallMatchingInput::Access.getInferredNonSelfType/2#dispred#b181cb0a#prev_delta` ON FIRST 2 OUTPUT Lhs.3, Rhs.3, _, Lhs.2, Rhs.2
{3} | REWRITE WITH Tmp.2 := "", Out.2 := InverseAppend(In.3,Tmp.2,In.4) KEEPING 3
65014 ~1% {3} | SCAN OUTPUT In.0, In.2, In.1
50151 ~1% {5} r3 = SCAN TypeInference::MethodCallMatching::AccessConstraint::MkRelevantAccess#7a01048b#prev_delta OUTPUT In.2, In.0, In.1, In.3, In.4
24208 ~1% {4} | JOIN WITH `FunctionType::FunctionPosition.isSelf/0#dispred#9e84d302` ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.3, Lhs.4
95022 ~0% {9} | JOIN WITH `TypeInference::MethodCallMatchingInput::Access.getInferredSelfType/3#dispred#45b2f893#prev` ON FIRST 1 OUTPUT Lhs.2, Lhs.3, Rhs.2, Rhs.3, Rhs.4, _, Rhs.1, Lhs.1, _
{6} | REWRITE WITH Tmp.5 := ";", Tmp.5 := (In.6 ++ Tmp.5), Tmp.8 := "", Out.5 := InverseAppend(Tmp.5,Tmp.8,In.7) KEEPING 6
93919 ~1% {7} | SCAN OUTPUT In.0, In.1, In.2, In.3, In.4, In.5, _
{6} | REWRITE WITH NOT [NOT [Tmp.6 := "borrow", TEST InOut.5 = Tmp.6, Tmp.6 := true, TEST InOut.2 = Tmp.6], NOT [Tmp.6 := "", TEST InOut.5 = Tmp.6, Tmp.6 := true, TEST InOut.2 != Tmp.6]] KEEPING 6
81298 ~1% {5} | SCAN OUTPUT In.1, In.4, _, In.0, In.3
{3} | REWRITE WITH Tmp.2 := "", Out.2 := InverseAppend(In.3,Tmp.2,In.4) KEEPING 3
64110 ~1% {3} | SCAN OUTPUT In.0, In.2, In.1
36102333 ~0% {5} r4 = SCAN TypeInference::MethodCallMatching::AccessConstraint::MkRelevantAccess#7a01048b#prev OUTPUT In.2, In.0, In.1, In.3, In.4
17473531 ~0% {4} | JOIN WITH `FunctionType::FunctionPosition.isSelf/0#dispred#9e84d302` ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.3, Lhs.4
47409 ~1% {9} | JOIN WITH `TypeInference::MethodCallMatchingInput::Access.getInferredSelfType/3#dispred#45b2f893#prev_delta` ON FIRST 1 OUTPUT Lhs.2, Lhs.3, Rhs.2, Rhs.3, Rhs.4, _, Rhs.1, Lhs.1, _
{6} | REWRITE WITH Tmp.5 := ";", Tmp.5 := (In.6 ++ Tmp.5), Tmp.8 := "", Out.5 := InverseAppend(Tmp.5,Tmp.8,In.7) KEEPING 6
29885 ~0% {7} | SCAN OUTPUT In.0, In.1, In.2, In.3, In.4, In.5, _
{6} | REWRITE WITH NOT [NOT [Tmp.6 := "borrow", TEST InOut.5 = Tmp.6, Tmp.6 := true, TEST InOut.2 = Tmp.6], NOT [Tmp.6 := "", TEST InOut.5 = Tmp.6, Tmp.6 := true, TEST InOut.2 != Tmp.6]] KEEPING 6
16952 ~1% {5} | SCAN OUTPUT In.1, In.4, _, In.0, In.3
{3} | REWRITE WITH Tmp.2 := "", Out.2 := InverseAppend(In.3,Tmp.2,In.4) KEEPING 3
16829 ~0% {3} | SCAN OUTPUT In.0, In.2, In.1
182949 ~1% {3} r5 = r1 UNION r2 UNION r3 UNION r4
182949 ~1% {3} | AND NOT `TypeInference::MethodCallMatching::AccessConstraint::RelevantAccess.getTypeAt/1#dispred#e8abf748#prev`(FIRST 3)
return r5
```
After
```
Pipeline standard for TypeInference::MethodCallMatching::AccessConstraint::RelevantAccess.getTypeAt/1#dispred#e8abf748@31ee547w was evaluated in 801 iterations totaling 19ms (delta sizes total: 182946).
81298 ~0% {5} r1 = JOIN TypeInference::MethodCallMatching::AccessConstraint::MkRelevantAccess#7a01048b#prev_delta WITH `TypeInference::MethodCallMatchingInput::Access.getInferredSelfType/3#dispred#45b2f893#prev` ON FIRST 3 OUTPUT Lhs.4, Rhs.4, _, Lhs.3, Rhs.3
{3} | REWRITE WITH Tmp.2 := "", Out.2 := InverseAppend(In.3,Tmp.2,In.4) KEEPING 3
64110 ~1% {3} | SCAN OUTPUT In.0, In.2, In.1
39574 ~0% {5} r2 = JOIN TypeInference::MethodCallMatching::AccessConstraint::MkRelevantAccess#7a01048b#prev_delta WITH `TypeInference::MethodCallMatchingInput::Access.getInferredNonSelfType/2#dispred#b181cb0a#prev` ON FIRST 2 OUTPUT Lhs.4, Rhs.3, _, Lhs.3, Rhs.2
{3} | REWRITE WITH Tmp.2 := "", Out.2 := InverseAppend(In.3,Tmp.2,In.4) KEEPING 3
36996 ~0% {3} | SCAN OUTPUT In.0, In.2, In.1
16952 ~0% {5} r3 = JOIN TypeInference::MethodCallMatching::AccessConstraint::MkRelevantAccess#7a01048b#prev WITH `TypeInference::MethodCallMatchingInput::Access.getInferredSelfType/3#dispred#45b2f893#prev_delta` ON FIRST 3 OUTPUT Lhs.4, Rhs.4, _, Lhs.3, Rhs.3
{3} | REWRITE WITH Tmp.2 := "", Out.2 := InverseAppend(In.3,Tmp.2,In.4) KEEPING 3
16829 ~0% {3} | SCAN OUTPUT In.0, In.2, In.1
90175 ~0% {5} r4 = JOIN TypeInference::MethodCallMatching::AccessConstraint::MkRelevantAccess#7a01048b#prev WITH `TypeInference::MethodCallMatchingInput::Access.getInferredNonSelfType/2#dispred#b181cb0a#prev_delta` ON FIRST 2 OUTPUT Lhs.4, Rhs.3, _, Lhs.3, Rhs.2
{3} | REWRITE WITH Tmp.2 := "", Out.2 := InverseAppend(In.3,Tmp.2,In.4) KEEPING 3
65014 ~0% {3} | SCAN OUTPUT In.0, In.2, In.1
182949 ~1% {3} r5 = r1 UNION r2 UNION r3 UNION r4
182949 ~1% {3} | AND NOT `TypeInference::MethodCallMatching::AccessConstraint::RelevantAccess.getTypeAt/1#dispred#e8abf748#prev`(FIRST 3)
return r5
```
Before
```
Pipeline standard for TypeInference::MethodCallMatching::directTypeMatch/6#f0fb0b61@31ee5u2w was evaluated in 821 iterations totaling 1057ms (delta sizes total: 689971).
416937 ~1% {6} r1 = SCAN `TypeInference::MethodCallMatching::directTypeMatch0/6#dfcc7717#prev_delta` OUTPUT In.0, In.3, In.1, In.2, In.4, In.5
222757 ~2% {8} r2 = JOIN r1 WITH `TypeInference::MethodCallMatchingInput::Access.getInferredNonSelfType/2#dispred#b181cb0a#prev` ON FIRST 2 OUTPUT Lhs.0, Lhs.2, Lhs.3, Lhs.5, Rhs.3, _, Lhs.4, Rhs.2
{6} | REWRITE WITH Tmp.5 := "", Out.5 := InverseAppend(In.6,Tmp.5,In.7) KEEPING 6
164360 ~3% {6} | SCAN OUTPUT In.0, In.1, In.2, In.5, In.4, In.3
315350783 ~1% {6} r3 = SCAN `TypeInference::MethodCallMatching::directTypeMatch0/6#dfcc7717#prev` OUTPUT In.0, In.3, In.1, In.2, In.4, In.5
593815 ~1% {8} r4 = JOIN r3 WITH `TypeInference::MethodCallMatchingInput::Access.getInferredNonSelfType/2#dispred#b181cb0a#prev_delta` ON FIRST 2 OUTPUT Lhs.0, Lhs.2, Lhs.3, Lhs.5, Rhs.3, _, Lhs.4, Rhs.2
{6} | REWRITE WITH Tmp.5 := "", Out.5 := InverseAppend(In.6,Tmp.5,In.7) KEEPING 6
342226 ~1% {6} | SCAN OUTPUT In.0, In.1, In.2, In.5, In.4, In.3
826517 ~0% {8} r5 = JOIN r1 WITH `TypeInference::MethodCallMatchingInput::Access.getInferredSelfType/3#dispred#45b2f893#prev` ON FIRST 3 OUTPUT Lhs.0, Lhs.2, Lhs.3, Lhs.5, Rhs.4, _, Lhs.4, Rhs.3
{6} | REWRITE WITH Tmp.5 := "", Out.5 := InverseAppend(In.6,Tmp.5,In.7) KEEPING 6
345294 ~1% {6} | SCAN OUTPUT In.0, In.1, In.2, In.5, In.4, In.3
73715 ~0% {8} r6 = JOIN r3 WITH `TypeInference::MethodCallMatchingInput::Access.getInferredSelfType/3#dispred#45b2f893#prev_delta` ON FIRST 3 OUTPUT Lhs.0, Lhs.2, Lhs.3, Lhs.5, Rhs.4, _, Lhs.4, Rhs.3
{6} | REWRITE WITH Tmp.5 := "", Out.5 := InverseAppend(In.6,Tmp.5,In.7) KEEPING 6
47802 ~1% {6} | SCAN OUTPUT In.0, In.1, In.2, In.5, In.4, In.3
899682 ~5% {6} r7 = r2 UNION r4 UNION r5 UNION r6
711040 ~6% {6} | AND NOT `TypeInference::MethodCallMatching::directTypeMatch/6#f0fb0b61#prev`(FIRST 6)
return r7
```
After
```
Pipeline standard for TypeInference::MethodCallMatching::directTypeMatch/6#f0fb0b61@ad458u2w was evaluated in 821 iterations totaling 374ms (delta sizes total: 691168).
222757 ~2% {8} r1 = JOIN `TypeInference::MethodCallMatching::directTypeMatch0/6#dfcc7717#prev_delta` WITH `TypeInference::MethodCallMatchingInput::Access.getInferredNonSelfType/2#dispred#b181cb0a#prev` ON FIRST 2 OUTPUT Lhs.0, Lhs.2, Lhs.3, Lhs.5, Rhs.3, _, Lhs.4, Rhs.2
{6} | REWRITE WITH Tmp.5 := "", Out.5 := InverseAppend(In.6,Tmp.5,In.7) KEEPING 6
164360 ~3% {6} | SCAN OUTPUT In.0, In.1, In.2, In.5, In.4, In.3
593815 ~1% {8} r2 = JOIN `TypeInference::MethodCallMatching::directTypeMatch0/6#dfcc7717#prev` WITH `TypeInference::MethodCallMatchingInput::Access.getInferredNonSelfType/2#dispred#b181cb0a#prev_delta` ON FIRST 2 OUTPUT Lhs.0, Lhs.2, Lhs.3, Lhs.5, Rhs.3, _, Lhs.4, Rhs.2
{6} | REWRITE WITH Tmp.5 := "", Out.5 := InverseAppend(In.6,Tmp.5,In.7) KEEPING 6
342226 ~1% {6} | SCAN OUTPUT In.0, In.1, In.2, In.5, In.4, In.3
826517 ~0% {8} r3 = JOIN `TypeInference::MethodCallMatching::directTypeMatch0/6#dfcc7717#prev_delta` WITH `TypeInference::MethodCallMatchingInput::Access.getInferredSelfType/3#dispred#45b2f893#prev` ON FIRST 3 OUTPUT Lhs.0, Lhs.2, Lhs.3, Lhs.5, Rhs.4, _, Lhs.4, Rhs.3
{6} | REWRITE WITH Tmp.5 := "", Out.5 := InverseAppend(In.6,Tmp.5,In.7) KEEPING 6
345294 ~1% {6} | SCAN OUTPUT In.0, In.1, In.2, In.5, In.4, In.3
73715 ~0% {8} r4 = JOIN `TypeInference::MethodCallMatching::directTypeMatch0/6#dfcc7717#prev` WITH `TypeInference::MethodCallMatchingInput::Access.getInferredSelfType/3#dispred#45b2f893#prev_delta` ON FIRST 3 OUTPUT Lhs.0, Lhs.2, Lhs.3, Lhs.5, Rhs.4, _, Lhs.4, Rhs.3
{6} | REWRITE WITH Tmp.5 := "", Out.5 := InverseAppend(In.6,Tmp.5,In.7) KEEPING 6
47802 ~1% {6} | SCAN OUTPUT In.0, In.1, In.2, In.5, In.4, In.3
899682 ~5% {6} r5 = r1 UNION r2 UNION r3 UNION r4
711095 ~6% {6} | AND NOT `TypeInference::MethodCallMatching::directTypeMatch/6#f0fb0b61#prev`(FIRST 6)
return r5
```
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR reorders the parameter lists in several predicate definitions and calls to improve consistency and potentially optimize join ordering in the QL compiler. The changes follow a pattern of placing structural parameters (like Access, AccessPosition, DeclarationPosition) before environment parameters (AccessEnvironment).
Key Changes
- Reordered parameters in
directTypeMatch0predicate and its call site to placeDeclarationPositionbeforeAccessEnvironment - Reordered parameters in
MkRelevantAccessnewtype constructor and corresponding class members to placeAccessPositionbeforeAccessEnvironment - Refactored
getInferredSelfTypemethod in Rust to acceptAccessPositionas a parameter and moved logic to improve code organization
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| shared/typeinference/codeql/typeinference/internal/TypeInference.qll | Reordered predicate parameters for directTypeMatch0 and MkRelevantAccess to follow consistent ordering pattern with position parameters before environment parameters |
| rust/ql/lib/codeql/rust/internal/TypeInference.qll | Refactored getInferredSelfType to accept AccessPosition as parameter and moved logic from getInferredType into it |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
paldepind
approved these changes
Oct 29, 2025
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.
See tuple counts in commit messages.
DCA is uneventful.