Skip to content

Commit a7c656d

Browse files
Performance: Fix bad join ordering
1 parent 225a69a commit a7c656d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ql/src/semmle/go/dataflow/internal/DataFlowUtil.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,20 +1163,23 @@ abstract class BarrierGuard extends Node {
11631163
* Holds if `guard` markes a point in the control-flow graph where this node
11641164
* is known to validate `nd`.
11651165
*/
1166+
pragma[noopt]
11661167
private predicate guards(ControlFlow::ConditionGuardNode guard, Node nd) {
1167-
exists(boolean branch |
1168-
this.checks(nd.asExpr(), branch) and
1168+
exists(boolean branch, Expr expr |
1169+
expr = nd.asExpr() and
1170+
this.checks(expr, branch) and
11691171
guard.ensures(this, branch)
11701172
)
11711173
or
11721174
exists(
11731175
Function f, FunctionInput inp, FunctionOutput outp, DataFlow::Property p, CallNode c,
1174-
Node resNode, Node check, boolean outcome
1176+
Node resNode, Node check, boolean outcome, Node functionOutput
11751177
|
11761178
guardingFunction(f, inp, outp, p) and
11771179
c = f.getACall() and
11781180
nd = inp.getNode(c) and
1179-
localFlow(outp.getNode(c), resNode) and
1181+
functionOutput = outp.getNode(c) and
1182+
localFlow(functionOutput, resNode) and
11801183
p.checkOn(check, outcome, resNode) and
11811184
guard.ensures(check, outcome)
11821185
)

0 commit comments

Comments
 (0)