Skip to content

Commit afb8c5a

Browse files
committed
Guards: Slight join-order improvement.
1 parent f0be0ae commit afb8c5a

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
@@ -1038,6 +1038,11 @@ module Make<LocationSig Location, InputSig<Location> Input> {
10381038

10391039
module ReturnImplies = ImpliesTC<returnGuard/2>;
10401040

1041+
pragma[nomagic]
1042+
private predicate directlyControlsReturn(Guard guard, GuardValue val, ReturnExpr ret) {
1043+
guard.directlyValueControls(ret.getBasicBlock(), val)
1044+
}
1045+
10411046
/**
10421047
* Holds if `ret` is a return expression in a non-overridable method that
10431048
* on a return value of `retval` allows the conclusion that the `ppos`th
@@ -1051,7 +1056,7 @@ module Make<LocationSig Location, InputSig<Location> Input> {
10511056
parameterDefinition(m.getParameter(ppos), param)
10521057
|
10531058
exists(Guard g0, GuardValue v0 |
1054-
g0.directlyValueControls(ret.getBasicBlock(), v0) and
1059+
directlyControlsReturn(g0, v0, ret) and
10551060
BranchImplies::ssaControls(param, val, g0, v0) and
10561061
relevantReturnValue(m, retval)
10571062
)

0 commit comments

Comments
 (0)