SSA: Make phiWithoutTwoPriorRefs consistency check more informative

This commit is contained in:
Tom Hvitved
2025-04-01 14:59:43 +02:00
parent 01810cbac9
commit 9dea9f5046
2 changed files with 8 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
uselessPhiNode
| sqlx.rs:155:5:157:5 | phi | 1 |
| sqlx.rs:155:5:157:5 | SSA phi(arg0) | 1 |
phiWithoutTwoPriorRefs
| sqlx.rs:155:5:157:5 | phi | 1 |
| sqlx.rs:155:5:157:5 | SSA phi(arg0) | sqlx.rs:155:5:157:5 | if enable_remote {...} | sqlx.rs:156:17:156:86 | arg0 | 1 |

View File

@@ -1412,13 +1412,12 @@ module Make<LocationSig Location, InputSig<Location> Input> {
}
/** Holds if `phi` has less than 2 immediately prior references. */
query predicate phiWithoutTwoPriorRefs(PhiNode phi, int inputRefs) {
exists(BasicBlock bbPhi, SourceVariable v |
phi.definesAt(v, bbPhi, _) and
inputRefs =
count(BasicBlock bb, int i | AdjacentSsaRefs::adjacentRefPhi(bb, i, _, bbPhi, v)) and
inputRefs < 2
)
query predicate phiWithoutTwoPriorRefs(
PhiNode phi, BasicBlock bbPhi, SourceVariable v, int inputRefs
) {
phi.definesAt(v, bbPhi, _) and
inputRefs = count(BasicBlock bb, int i | AdjacentSsaRefs::adjacentRefPhi(bb, i, _, bbPhi, v)) and
inputRefs < 2
}
/**