@@ -247,7 +247,7 @@ private class GuardConditionFromIR extends GuardCondition {
247
247
248
248
/**
249
249
* 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
251
251
* predicate does not necessarily hold for binary logical operations like
252
252
* `&&` and `||`. See the detailed explanation on predicate `controls`.
253
253
*/
@@ -303,6 +303,24 @@ class IRGuardCondition extends Instruction {
303
303
cached
304
304
IRGuardCondition ( ) { branch = getBranchForCondition ( this ) }
305
305
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
+
306
324
/**
307
325
* Holds if this condition controls `controlled`, meaning that `controlled` is only
308
326
* entered if the value of this condition is `testIsTrue`.
@@ -329,18 +347,6 @@ class IRGuardCondition extends Instruction {
329
347
* being short-circuited) then it will only control blocks dominated by the
330
348
* true (for `&&`) or false (for `||`) branch.
331
349
*/
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
-
344
350
cached
345
351
predicate controls ( IRBlock controlled , boolean testIsTrue ) {
346
352
this .valueControls ( controlled , any ( BooleanValue bv | bv .getValue ( ) = testIsTrue ) )
@@ -375,7 +381,7 @@ class IRGuardCondition extends Instruction {
375
381
}
376
382
377
383
/**
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 `.
379
385
*
380
386
* This predicate is intended to help with situations in which an inference can only be made
381
387
* based on an edge between a block with multiple successors and a block with multiple
0 commit comments