Skip to content

Commit fa09d21

Browse files
committed
C++: Simplify. No need for the 'PhiInputNodeExt' class.
1 parent 31bc426 commit fa09d21

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,9 +2681,9 @@ class ContentSet instanceof Content {
26812681

26822682
pragma[nomagic]
26832683
private predicate guardControlsPhiInput(
2684-
IRGuardCondition g, boolean branch, Ssa::Definition def, IRBlock input, Ssa::PhiInputNodeExt phi
2684+
IRGuardCondition g, boolean branch, Ssa::Definition def, IRBlock input, Ssa::PhiNode phi
26852685
) {
2686-
phi.hasInputFromBlock(def, input) and
2686+
phi.hasInputFromBlock(def, _, _, _, input) and
26872687
(
26882688
g.controls(input, branch)
26892689
or
@@ -2752,12 +2752,11 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
27522752
)
27532753
or
27542754
exists(
2755-
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input,
2756-
Ssa::PhiInputNodeExt phi
2755+
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input, Ssa::PhiNode phi
27572756
|
27582757
guardChecks(g, def.getARead().asOperand().getDef().getConvertedResultExpression(), branch) and
27592758
guardControlsPhiInput(g, branch, def, input, phi) and
2760-
result = TSsaPhiInputNode(phi.getPhi(), input)
2759+
result = TSsaPhiInputNode(phi, input)
27612760
)
27622761
}
27632762

@@ -2839,14 +2838,13 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
28392838
)
28402839
or
28412840
exists(
2842-
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input,
2843-
Ssa::PhiInputNodeExt phi
2841+
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input, Ssa::PhiNode phi
28442842
|
28452843
guardChecks(g,
28462844
def.getARead().asIndirectOperand(indirectionIndex).getDef().getConvertedResultExpression(),
28472845
branch) and
28482846
guardControlsPhiInput(g, branch, def, input, phi) and
2849-
result = TSsaPhiInputNode(phi.getPhi(), input)
2847+
result = TSsaPhiInputNode(phi, input)
28502848
)
28512849
}
28522850
}
@@ -2881,12 +2879,11 @@ module InstructionBarrierGuard<instructionGuardChecksSig/3 instructionGuardCheck
28812879
)
28822880
or
28832881
exists(
2884-
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input,
2885-
Ssa::PhiInputNodeExt phi
2882+
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input, Ssa::PhiNode phi
28862883
|
28872884
instructionGuardChecks(g, def.getARead().asOperand().getDef(), branch) and
28882885
guardControlsPhiInput(g, branch, def, input, phi) and
2889-
result = TSsaPhiInputNode(phi.getPhi(), input)
2886+
result = TSsaPhiInputNode(phi, input)
28902887
)
28912888
}
28922889
}

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,23 +1215,6 @@ class Phi extends TPhi, SsaDef {
12151215

12161216
private module SsaImpl = SsaImplCommon::Make<Location, SsaInput>;
12171217

1218-
/**
1219-
* An static single assignment (SSA) definition that is used as an input to a
1220-
* phi or phi-read node.
1221-
*/
1222-
class PhiInputNodeExt extends SsaImpl::DefinitionExt {
1223-
PhiNode phi;
1224-
1225-
PhiInputNodeExt() { this = SsaCached::phiHasInputFromBlockExt(phi, _) }
1226-
1227-
/** Gets the phi or phi-read node that receives this node as input. */
1228-
PhiNode getPhi() { result = phi }
1229-
1230-
predicate hasInputFromBlock(DefinitionExt def, IRBlock input) {
1231-
SsaCached::lastRefRedefExt(def, _, _, _, input, this)
1232-
}
1233-
}
1234-
12351218
/**
12361219
* An static single assignment (SSA) phi node.
12371220
*

0 commit comments

Comments
 (0)