From 94121f19ca5b2462fc9ce6428d1210feb57765a2 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Mon, 23 Feb 2026 10:56:36 +0100 Subject: [PATCH] Guards: Improve join-order. --- shared/controlflow/codeql/controlflow/Guards.qll | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/controlflow/codeql/controlflow/Guards.qll b/shared/controlflow/codeql/controlflow/Guards.qll index f6774db1eb9..9a4f65bcd53 100644 --- a/shared/controlflow/codeql/controlflow/Guards.qll +++ b/shared/controlflow/codeql/controlflow/Guards.qll @@ -597,6 +597,12 @@ module Make< module Logic { private import LogicInput + bindingset[bb1, bb2] + pragma[inline_late] + private predicate strictlyDominatesCheck(BasicBlock bb1, BasicBlock bb2) { + bb1.strictlyDominates(bb2) + } + /** * Holds if `guard` evaluating to `v` directly controls `phi` taking the value * `inp`. This means that `guard` evaluating to `v` must control all the input @@ -614,7 +620,7 @@ module Make< exists(BasicBlock bbPhi | phi.hasInputFromBlock(inp, _) and phi.getBasicBlock() = bbPhi and - guard.getBasicBlock().strictlyDominates(bbPhi) and + strictlyDominatesCheck(guard.getBasicBlock(), bbPhi) and not guard.directlyValueControls(bbPhi, _) and forex(BasicBlock bbInput | phi.hasInputFromBlock(inp, bbInput) | guard.directlyValueControls(bbInput, v) or