From a40ae3a11a59575c78ba1b5463fbb4be0cf73410 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Thu, 24 Jul 2025 15:26:38 +0200 Subject: [PATCH] Guards: Slight join-order improvement. --- shared/controlflow/codeql/controlflow/Guards.qll | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared/controlflow/codeql/controlflow/Guards.qll b/shared/controlflow/codeql/controlflow/Guards.qll index 3f7ebc9a955..ed2691fbf0e 100644 --- a/shared/controlflow/codeql/controlflow/Guards.qll +++ b/shared/controlflow/codeql/controlflow/Guards.qll @@ -1031,6 +1031,11 @@ module Make Input> { module ReturnImplies = ImpliesTC; + pragma[nomagic] + private predicate directlyControlsReturn(Guard guard, GuardValue val, ReturnExpr ret) { + guard.directlyValueControls(ret.getBasicBlock(), val) + } + /** * Holds if `ret` is a return expression in a non-overridable method that * on a return value of `retval` allows the conclusion that the `ppos`th @@ -1044,7 +1049,7 @@ module Make Input> { parameterDefinition(m.getParameter(ppos), param) | exists(Guard g0, GuardValue v0 | - g0.directlyValueControls(ret.getBasicBlock(), v0) and + directlyControlsReturn(g0, v0, ret) and BranchImplies::ssaControls(param, val, g0, v0) and relevantReturnValue(m, retval) )