Skip to content

Commit 62e28d2

Browse files
committed
Guards: Simplify non-linear join.
1 parent 3c7522c commit 62e28d2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

shared/controlflow/codeql/controlflow/Guards.qll

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,15 @@ module Make<
10821082
guard.directlyValueControls(ret.getBasicBlock(), val)
10831083
}
10841084

1085+
private predicate parameterControlsReturnExpr(
1086+
SsaParameterInit param, GuardValue val, ReturnExpr ret
1087+
) {
1088+
exists(Guard g0, GuardValue v0 |
1089+
directlyControlsReturn(g0, v0, ret) and
1090+
BranchImplies::ssaControls(param, val, g0, v0)
1091+
)
1092+
}
1093+
10851094
/**
10861095
* Holds if `ret` is a return expression in a non-overridable method that
10871096
* on a return value of `retval` allows the conclusion that the `ppos`th
@@ -1095,11 +1104,8 @@ module Make<
10951104
ret = rankedReturnExpr(m, rnk) and
10961105
param.getParameter() = m.getParameter(ppos)
10971106
|
1098-
exists(Guard g0, GuardValue v0 |
1099-
directlyControlsReturn(g0, v0, ret) and
1100-
BranchImplies::ssaControls(param, val, g0, v0) and
1101-
relevantReturnExprValue(m, ret, retval)
1102-
)
1107+
parameterControlsReturnExpr(param, val, ret) and
1108+
relevantReturnExprValue(m, ret, retval)
11031109
or
11041110
ReturnImplies::ssaControls(param, val, ret, retval)
11051111
)

0 commit comments

Comments
 (0)