@@ -247,7 +247,7 @@ private class GuardConditionFromIR extends GuardCondition {
247247
248248 /**
249249 * Holds if this condition controls `block`, meaning that `block` is only
250- * entered if the value of this condition is `testIsTrue `. This helper
250+ * entered if the value of this condition is `v `. This helper
251251 * predicate does not necessarily hold for binary logical operations like
252252 * `&&` and `||`. See the detailed explanation on predicate `controls`.
253253 */
@@ -303,6 +303,24 @@ class IRGuardCondition extends Instruction {
303303 cached
304304 IRGuardCondition ( ) { branch = getBranchForCondition ( this ) }
305305
306+ /**
307+ * Holds if this condition controls `controlled`, meaning that `controlled` is only
308+ * entered if the value of this condition is `v`.
309+ *
310+ * For details on what "controls" mean, see the QLDoc for `controls`.
311+ */
312+ cached
313+ predicate valueControls ( IRBlock controlled , AbstractValue v ) {
314+ // This condition must determine the flow of control; that is, this
315+ // node must be a top-level condition.
316+ this .controlsBlock ( controlled , v )
317+ or
318+ exists ( IRGuardCondition ne |
319+ this = ne .( LogicalNotInstruction ) .getUnary ( ) and
320+ ne .valueControls ( controlled , v .getDualValue ( ) )
321+ )
322+ }
323+
306324 /**
307325 * Holds if this condition controls `controlled`, meaning that `controlled` is only
308326 * entered if the value of this condition is `testIsTrue`.
@@ -329,18 +347,6 @@ class IRGuardCondition extends Instruction {
329347 * being short-circuited) then it will only control blocks dominated by the
330348 * true (for `&&`) or false (for `||`) branch.
331349 */
332- cached
333- predicate valueControls ( IRBlock controlled , AbstractValue v ) {
334- // This condition must determine the flow of control; that is, this
335- // node must be a top-level condition.
336- this .controlsBlock ( controlled , v )
337- or
338- exists ( IRGuardCondition ne |
339- this = ne .( LogicalNotInstruction ) .getUnary ( ) and
340- ne .valueControls ( controlled , v .getDualValue ( ) )
341- )
342- }
343-
344350 cached
345351 predicate controls ( IRBlock controlled , boolean testIsTrue ) {
346352 this .valueControls ( controlled , any ( BooleanValue bv | bv .getValue ( ) = testIsTrue ) )
@@ -375,7 +381,7 @@ class IRGuardCondition extends Instruction {
375381 }
376382
377383 /**
378- * Gets the block to which `branch` jumps directly when this condition is `testIsTrue `.
384+ * Gets the block to which `branch` jumps directly when the value of this condition is `v `.
379385 *
380386 * This predicate is intended to help with situations in which an inference can only be made
381387 * based on an edge between a block with multiple successors and a block with multiple
0 commit comments