Gaurds: Improve perf of forall in guardDeterminesPhiInput.

This commit is contained in:
Anders Schack-Mulligen
2026-03-04 10:56:51 +01:00
parent e695477f4f
commit ad5ab9f270

View File

@@ -641,6 +641,9 @@ module Make<
) {
exists(GuardValue dv, SsaExplicitWrite inp |
guardControlsPhiBranch(guard, v, phi, inp) and
// The `forall` below implies that there's only one such `inp` guarded by `guard == v`,
// but checking this upfront improves performance of the `forall` check.
1 = strictcount(SsaDefinition inp0 | guardControlsPhiBranch(guard, v, phi, inp0)) and
inp.getValue() = input and
dv = v.getDualValue() and
forall(SsaDefinition other | phi.hasInputFromBlock(other, _) and other != inp |