C++: Add comment on why getGuardedUpperBound must have exactly one predecessor

This commit is contained in:
Anders Fugmann
2021-09-06 10:31:32 +02:00
parent d962fc4ce1
commit e4d22ea628

View File

@@ -1540,6 +1540,13 @@ private float getGuardedUpperBound(VariableAccess guardedAccess) {
RangeSsaDefinition def, StackVariable v, VariableAccess guardVa, Expr guard, boolean branch
|
def.isGuardPhi(v, guardVa, guard, branch) and
// If the basic block for the variable access being examined has
// more than one predecessor, the guard phi node could originate
// from one of the predecessors. This is because the guard phi
// node is attached to the block at the end of the edge and not on
// the actual edge. It is therefore possible to determine which
// edge the guard phi node belongs to. The predicate below ensures
// that there is one predecessor, albeit somewhat conservative.
exists(unique(BasicBlock b | b = def.(BasicBlock).getAPredecessor())) and
guardedAccess = def.getAUse(v) and
result = max(float ub | upperBoundFromGuard(guard, guardVa, ub, branch))