C++: Use the hasBranchEdge helper predicate

This tidies up the code, removing unnecessary repetition.
This commit is contained in:
Jonas Jensen
2020-06-09 10:33:03 +02:00
parent 398678a28b
commit cade3a3e23

View File

@@ -407,11 +407,7 @@ class IRGuardCondition extends Instruction {
not isUnreachedBlock(controlled) and
exists(IRBlock branchBlock | branchBlock.getAnInstruction() = branch |
exists(IRBlock succ |
testIsTrue = true and succ.getFirstInstruction() = branch.getTrueSuccessor()
or
testIsTrue = false and succ.getFirstInstruction() = branch.getFalseSuccessor()
|
branch.getCondition() = this and
this.hasBranchEdge(succ, testIsTrue) and
succ.dominates(controlled) and
forall(IRBlock pred | pred.getASuccessor() = succ |
pred = branchBlock or succ.dominates(pred) or not pred.isReachableFromFunctionEntry()