From a7c656db8bfe5c2b7f7336d81aa61c9ee6d36f9b Mon Sep 17 00:00:00 2001 From: Edoardo Pirovano Date: Mon, 21 Jun 2021 18:58:35 +0100 Subject: [PATCH] Performance: Fix bad join ordering --- ql/src/semmle/go/dataflow/internal/DataFlowUtil.qll | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ql/src/semmle/go/dataflow/internal/DataFlowUtil.qll b/ql/src/semmle/go/dataflow/internal/DataFlowUtil.qll index 9efbbd4e1e3..6f04ed655c0 100644 --- a/ql/src/semmle/go/dataflow/internal/DataFlowUtil.qll +++ b/ql/src/semmle/go/dataflow/internal/DataFlowUtil.qll @@ -1163,20 +1163,23 @@ abstract class BarrierGuard extends Node { * Holds if `guard` markes a point in the control-flow graph where this node * is known to validate `nd`. */ + pragma[noopt] private predicate guards(ControlFlow::ConditionGuardNode guard, Node nd) { - exists(boolean branch | - this.checks(nd.asExpr(), branch) and + exists(boolean branch, Expr expr | + expr = nd.asExpr() and + this.checks(expr, branch) and guard.ensures(this, branch) ) or exists( Function f, FunctionInput inp, FunctionOutput outp, DataFlow::Property p, CallNode c, - Node resNode, Node check, boolean outcome + Node resNode, Node check, boolean outcome, Node functionOutput | guardingFunction(f, inp, outp, p) and c = f.getACall() and nd = inp.getNode(c) and - localFlow(outp.getNode(c), resNode) and + functionOutput = outp.getNode(c) and + localFlow(functionOutput, resNode) and p.checkOn(check, outcome, resNode) and guard.ensures(check, outcome) )