C++: Fix internal SCC edges and accept test changes.

This commit is contained in:
Mathias Vorreiter Pedersen
2026-05-19 15:39:32 +01:00
parent f77d426706
commit f5113b1932
2 changed files with 5 additions and 9 deletions

View File

@@ -1379,15 +1379,11 @@ class PhiNode extends Definition instanceof SsaImpl::PhiNode {
private PhiNode getAnInput(PhiNode phi) { result = phi.getAnInput() }
private predicate definitionCycle(PhiNode phi) { getAnInput+(phi) = phi }
private predicate hasAnInput(PhiNode phi1, PhiNode phi2) {
definitionCycle(phi1) and
definitionCycle(phi2) and
getAnInput(phi1) = phi2
private predicate sccEdge(PhiNode phi1, PhiNode phi2) {
getAnInput(phi1) = phi2 and getAnInput+(phi2) = phi1
}
private module PhiCycleEquivalence = QlBuiltins::EquivalenceRelation<PhiNode, hasAnInput/2>;
private module PhiCycleEquivalence = QlBuiltins::EquivalenceRelation<PhiNode, sccEdge/2>;
private PhiCycle getCycle(PhiNode phi) { result.getAPhiNode() = phi }

View File

@@ -67,11 +67,11 @@ void test(int x, bool b1, bool b2) { // $ certain="SSA def(&x)" certain="SSA def
int* p = &x; // $ certain="SSA def(&p)" certain="SSA def(p)" certain="SSA def(*p)"
int i = 0; // $ certain="SSA def(&i)" certain="SSA def(i)"
int j = 0; // $ certain="SSA def(&j)" certain="SSA def(j)"
while (i < 10) { // $ certain="SSA phi(i)" uncertain="SSA phi(*p)"
while (i < 10) { // $ certain="SSA phi(i)" certain="SSA phi(*p)"
if (b1) {
*p = 0; // $ certain="SSA def(*p)"
}
++i; // $ certain="SSA def(i)" uncertain="SSA phi(*p)"
++i; // $ certain="SSA def(i)" certain="SSA phi(*p)"
}
while (j < 10) { // $ uncertain="SSA phi(*p)" certain="SSA phi(j)"
if (b2) {