C++: Simplify. No need for the 'PhiInputNodeExt' class.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-06-06 15:33:38 +01:00
parent 31bc4263e7
commit fa09d21c32
2 changed files with 8 additions and 28 deletions

View File

@@ -2681,9 +2681,9 @@ class ContentSet instanceof Content {
pragma[nomagic]
private predicate guardControlsPhiInput(
IRGuardCondition g, boolean branch, Ssa::Definition def, IRBlock input, Ssa::PhiInputNodeExt phi
IRGuardCondition g, boolean branch, Ssa::Definition def, IRBlock input, Ssa::PhiNode phi
) {
phi.hasInputFromBlock(def, input) and
phi.hasInputFromBlock(def, _, _, _, input) and
(
g.controls(input, branch)
or
@@ -2752,12 +2752,11 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
)
or
exists(
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input,
Ssa::PhiInputNodeExt phi
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input, Ssa::PhiNode phi
|
guardChecks(g, def.getARead().asOperand().getDef().getConvertedResultExpression(), branch) and
guardControlsPhiInput(g, branch, def, input, phi) and
result = TSsaPhiInputNode(phi.getPhi(), input)
result = TSsaPhiInputNode(phi, input)
)
}
@@ -2839,14 +2838,13 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
)
or
exists(
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input,
Ssa::PhiInputNodeExt phi
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input, Ssa::PhiNode phi
|
guardChecks(g,
def.getARead().asIndirectOperand(indirectionIndex).getDef().getConvertedResultExpression(),
branch) and
guardControlsPhiInput(g, branch, def, input, phi) and
result = TSsaPhiInputNode(phi.getPhi(), input)
result = TSsaPhiInputNode(phi, input)
)
}
}
@@ -2881,12 +2879,11 @@ module InstructionBarrierGuard<instructionGuardChecksSig/3 instructionGuardCheck
)
or
exists(
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input,
Ssa::PhiInputNodeExt phi
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input, Ssa::PhiNode phi
|
instructionGuardChecks(g, def.getARead().asOperand().getDef(), branch) and
guardControlsPhiInput(g, branch, def, input, phi) and
result = TSsaPhiInputNode(phi.getPhi(), input)
result = TSsaPhiInputNode(phi, input)
)
}
}

View File

@@ -1215,23 +1215,6 @@ class Phi extends TPhi, SsaDef {
private module SsaImpl = SsaImplCommon::Make<Location, SsaInput>;
/**
* An static single assignment (SSA) definition that is used as an input to a
* phi or phi-read node.
*/
class PhiInputNodeExt extends SsaImpl::DefinitionExt {
PhiNode phi;
PhiInputNodeExt() { this = SsaCached::phiHasInputFromBlockExt(phi, _) }
/** Gets the phi or phi-read node that receives this node as input. */
PhiNode getPhi() { result = phi }
predicate hasInputFromBlock(DefinitionExt def, IRBlock input) {
SsaCached::lastRefRedefExt(def, _, _, _, input, this)
}
}
/**
* An static single assignment (SSA) phi node.
*