Skip to content

Commit 9dea9f5

Browse files
committed
SSA: Make phiWithoutTwoPriorRefs consistency check more informative
1 parent 01810cb commit 9dea9f5

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
uselessPhiNode
2-
| sqlx.rs:155:5:157:5 | phi | 1 |
2+
| sqlx.rs:155:5:157:5 | SSA phi(arg0) | 1 |
33
phiWithoutTwoPriorRefs
4-
| sqlx.rs:155:5:157:5 | phi | 1 |
4+
| 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 |

shared/ssa/codeql/ssa/Ssa.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,13 +1412,12 @@ module Make<LocationSig Location, InputSig<Location> Input> {
14121412
}
14131413

14141414
/** Holds if `phi` has less than 2 immediately prior references. */
1415-
query predicate phiWithoutTwoPriorRefs(PhiNode phi, int inputRefs) {
1416-
exists(BasicBlock bbPhi, SourceVariable v |
1417-
phi.definesAt(v, bbPhi, _) and
1418-
inputRefs =
1419-
count(BasicBlock bb, int i | AdjacentSsaRefs::adjacentRefPhi(bb, i, _, bbPhi, v)) and
1420-
inputRefs < 2
1421-
)
1415+
query predicate phiWithoutTwoPriorRefs(
1416+
PhiNode phi, BasicBlock bbPhi, SourceVariable v, int inputRefs
1417+
) {
1418+
phi.definesAt(v, bbPhi, _) and
1419+
inputRefs = count(BasicBlock bb, int i | AdjacentSsaRefs::adjacentRefPhi(bb, i, _, bbPhi, v)) and
1420+
inputRefs < 2
14221421
}
14231422

14241423
/**

0 commit comments

Comments
 (0)