Skip to content

Commit ad5ab9f

Browse files
committed
Gaurds: Improve perf of forall in guardDeterminesPhiInput.
1 parent e695477 commit ad5ab9f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

shared/controlflow/codeql/controlflow/Guards.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,9 @@ module Make<
641641
) {
642642
exists(GuardValue dv, SsaExplicitWrite inp |
643643
guardControlsPhiBranch(guard, v, phi, inp) and
644+
// The `forall` below implies that there's only one such `inp` guarded by `guard == v`,
645+
// but checking this upfront improves performance of the `forall` check.
646+
1 = strictcount(SsaDefinition inp0 | guardControlsPhiBranch(guard, v, phi, inp0)) and
644647
inp.getValue() = input and
645648
dv = v.getDualValue() and
646649
forall(SsaDefinition other | phi.hasInputFromBlock(other, _) and other != inp |

0 commit comments

Comments
 (0)