Skip to content

Commit 136c8b5

Browse files
committed
Data flow: Improve callMayFlowThroughFwd join order
Before: ``` [2021-08-25 09:56:29] (1395s) Tuple counts for DataFlowImpl2::Stage3::callMayFlowThroughFwd#ff/2@111fb3: 15495496 ~5% {5} r1 = SCAN DataFlowImpl2::Stage3::fwdFlowOutFromArg#fffff#reorder_0_2_4_1_3 OUTPUT In.3, In.4, In.2 'config', In.0 'call', In.1 1450611958 ~6335% {5} r2 = JOIN r1 WITH DataFlowImpl2::Stage3::fwdFlow#fffff_03412#join_rhs ON FIRST 3 OUTPUT Lhs.3 'call', Lhs.4, Lhs.2 'config', Rhs.3, Rhs.4 7043648 ~20415% {2} r3 = JOIN r2 WITH DataFlowImpl2::Stage3::fwdFlowIsEntered#fffff#reorder_0_3_4_1_2 ON FIRST 5 OUTPUT Lhs.0 'call', Lhs.2 'config' return r3 ``` After: ``` [2021-08-25 10:57:02] (2652s) Tuple counts for DataFlowImpl2::Stage3::callMayFlowThroughFwd#ff/2@d3e27b: 15495496 ~0% {6} r1 = SCAN DataFlowImpl2::Stage3::fwdFlowOutFromArg#fffff#reorder_0_2_4_1_3 OUTPUT In.0 'call', In.1, In.2 'config', In.3, In.4, In.2 'config' 9236888 ~22% {7} r2 = JOIN r1 WITH DataFlowImpl2::Stage3::fwdFlowIsEntered#fffff#reorder_0_3_4_1_2 ON FIRST 3 OUTPUT Lhs.3, Rhs.3, Rhs.4, Lhs.4, Lhs.5, Lhs.0 'call', Lhs.2 'config' 7043648 ~20415% {2} r3 = JOIN r2 WITH DataFlowImpl2::Stage3::fwdFlow#fffff ON FIRST 5 OUTPUT Lhs.5 'call', Lhs.6 'config' return r3 ```
1 parent 7fc536d commit 136c8b5

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,11 +1170,10 @@ private module Stage2 {
11701170
pragma[nomagic]
11711171
private predicate callMayFlowThroughFwd(DataFlowCall call, Configuration config) {
11721172
exists(Ap argAp0, NodeEx out, Cc cc, ApOption argAp, Ap ap |
1173-
fwdFlow(out, pragma[only_bind_into](cc), pragma[only_bind_into](argAp), ap,
1174-
pragma[only_bind_into](config)) and
1173+
fwdFlow(pragma[only_bind_out](out), pragma[only_bind_out](cc), pragma[only_bind_out](argAp),
1174+
pragma[only_bind_out](ap), pragma[only_bind_out](config)) and
11751175
fwdFlowOutFromArg(call, out, argAp0, ap, config) and
1176-
fwdFlowIsEntered(call, pragma[only_bind_into](cc), pragma[only_bind_into](argAp), argAp0,
1177-
pragma[only_bind_into](config))
1176+
fwdFlowIsEntered(call, cc, argAp, argAp0, config)
11781177
)
11791178
}
11801179

@@ -1858,11 +1857,10 @@ private module Stage3 {
18581857
pragma[nomagic]
18591858
private predicate callMayFlowThroughFwd(DataFlowCall call, Configuration config) {
18601859
exists(Ap argAp0, NodeEx out, Cc cc, ApOption argAp, Ap ap |
1861-
fwdFlow(out, pragma[only_bind_into](cc), pragma[only_bind_into](argAp), ap,
1862-
pragma[only_bind_into](config)) and
1860+
fwdFlow(pragma[only_bind_out](out), pragma[only_bind_out](cc), pragma[only_bind_out](argAp),
1861+
pragma[only_bind_out](ap), pragma[only_bind_out](config)) and
18631862
fwdFlowOutFromArg(call, out, argAp0, ap, config) and
1864-
fwdFlowIsEntered(call, pragma[only_bind_into](cc), pragma[only_bind_into](argAp), argAp0,
1865-
pragma[only_bind_into](config))
1863+
fwdFlowIsEntered(call, cc, argAp, argAp0, config)
18661864
)
18671865
}
18681866

@@ -2616,11 +2614,10 @@ private module Stage4 {
26162614
pragma[nomagic]
26172615
private predicate callMayFlowThroughFwd(DataFlowCall call, Configuration config) {
26182616
exists(Ap argAp0, NodeEx out, Cc cc, ApOption argAp, Ap ap |
2619-
fwdFlow(out, pragma[only_bind_into](cc), pragma[only_bind_into](argAp), ap,
2620-
pragma[only_bind_into](config)) and
2617+
fwdFlow(pragma[only_bind_out](out), pragma[only_bind_out](cc), pragma[only_bind_out](argAp),
2618+
pragma[only_bind_out](ap), pragma[only_bind_out](config)) and
26212619
fwdFlowOutFromArg(call, out, argAp0, ap, config) and
2622-
fwdFlowIsEntered(call, pragma[only_bind_into](cc), pragma[only_bind_into](argAp), argAp0,
2623-
pragma[only_bind_into](config))
2620+
fwdFlowIsEntered(call, cc, argAp, argAp0, config)
26242621
)
26252622
}
26262623

0 commit comments

Comments
 (0)