@@ -168,6 +168,29 @@ final class BasicBlock extends BasicBlocksImpl::BasicBlock {
168168 */
169169 BasicBlock getImmediateDominator ( ) { result = super .getImmediateDominator ( ) }
170170
171+ /**
172+ * Holds if the edge with successor type `s` out of this basic block is a
173+ * dominating edge for `dominated`.
174+ *
175+ * That is, all paths reaching `dominated` from the entry point basic
176+ * block must go through the `s` edge out of this basic block.
177+ *
178+ * Edge dominance is similar to node dominance except it concerns edges
179+ * instead of nodes: A basic block is dominated by a _basic block_ `bb` if it
180+ * can only be reached through `bb` and dominated by an _edge_ `s` if it can
181+ * only be reached through `s`.
182+ *
183+ * Note that where all basic blocks (except the entry basic block) are
184+ * strictly dominated by at least one basic block, a basic block may not be
185+ * dominated by any edge. If an edge dominates a basic block `bb`, then
186+ * both endpoints of the edge dominates `bb`. The converse is not the case,
187+ * as there may be multiple paths between the endpoints with none of them
188+ * dominating.
189+ */
190+ predicate edgeDominates ( BasicBlock dominated , SuccessorType s ) {
191+ super .edgeDominates ( dominated , s )
192+ }
193+
171194 /**
172195 * Holds if this basic block strictly post-dominates basic block `bb`.
173196 *
@@ -248,21 +271,26 @@ final class JoinBlockPredecessor extends BasicBlock, BasicBlocksImpl::JoinPredec
248271 */
249272final class ConditionBlock extends BasicBlock , BasicBlocksImpl:: ConditionBasicBlock {
250273 /**
274+ * DEPRECATED: Use `edgeDominates` instead.
275+ *
251276 * Holds if basic block `succ` is immediately controlled by this basic
252277 * block with conditional value `s`. That is, `succ` is an immediate
253278 * successor of this block, and `succ` can only be reached from
254279 * the callable entry point by going via the `s` edge out of this basic block.
255280 */
256- predicate immediatelyControls ( BasicBlock succ , ConditionalSuccessor s ) {
257- super .immediatelyControls ( succ , s )
281+ deprecated predicate immediatelyControls ( BasicBlock succ , ConditionalSuccessor s ) {
282+ this .getASuccessor ( s ) = succ and
283+ BasicBlocksImpl:: dominatingEdge ( this , succ )
258284 }
259285
260286 /**
287+ * DEPRECATED: Use `edgeDominates` instead.
288+ *
261289 * Holds if basic block `controlled` is controlled by this basic block with
262290 * conditional value `s`. That is, `controlled` can only be reached from the
263291 * callable entry point by going via the `s` edge out of this basic block.
264292 */
265- predicate controls ( BasicBlock controlled , ConditionalSuccessor s ) {
266- super .controls ( controlled , s )
293+ deprecated predicate controls ( BasicBlock controlled , ConditionalSuccessor s ) {
294+ super .edgeDominates ( controlled , s )
267295 }
268296}
0 commit comments