Skip to content

Commit 9615582

Browse files
committed
Guards: Slight join-order improvement.
1 parent 7127cca commit 9615582

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

shared/controlflow/codeql/controlflow/Guards.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,11 @@ module Make<LocationSig Location, InputSig<Location> Input> {
10311031

10321032
module ReturnImplies = ImpliesTC<returnGuard/2>;
10331033

1034+
pragma[nomagic]
1035+
private predicate directlyControlsReturn(Guard guard, GuardValue val, ReturnExpr ret) {
1036+
guard.directlyValueControls(ret.getBasicBlock(), val)
1037+
}
1038+
10341039
/**
10351040
* Holds if `ret` is a return expression in a non-overridable method that
10361041
* on a return value of `retval` allows the conclusion that the `ppos`th
@@ -1044,7 +1049,7 @@ module Make<LocationSig Location, InputSig<Location> Input> {
10441049
parameterDefinition(m.getParameter(ppos), param)
10451050
|
10461051
exists(Guard g0, GuardValue v0 |
1047-
g0.directlyValueControls(ret.getBasicBlock(), v0) and
1052+
directlyControlsReturn(g0, v0, ret) and
10481053
BranchImplies::ssaControls(param, val, g0, v0) and
10491054
relevantReturnValue(m, retval)
10501055
)

0 commit comments

Comments
 (0)