@@ -2275,7 +2275,7 @@ private predicate guardControlsPhiInput(
2275
2275
*/
2276
2276
signature predicate guardChecksSig ( IRGuardCondition g , Expr e , boolean branch ) ;
2277
2277
2278
- bindingset [ g, n ]
2278
+ bindingset [ g]
2279
2279
pragma [ inline_late]
2280
2280
private predicate controls ( IRGuardCondition g , Node n , boolean edge ) {
2281
2281
g .controls ( n .getBasicBlock ( ) , edge )
@@ -2288,6 +2288,15 @@ private predicate controls(IRGuardCondition g, Node n, boolean edge) {
2288
2288
* in data flow and taint tracking.
2289
2289
*/
2290
2290
module BarrierGuard< guardChecksSig / 3 guardChecks> {
2291
+ bindingset [ value, n]
2292
+ pragma [ inline_late]
2293
+ private predicate convertedExprHasValueNumber ( ValueNumber value , Node n ) {
2294
+ exists ( Expr e |
2295
+ e = value .getAnInstruction ( ) .getConvertedResultExpression ( ) and
2296
+ n .asConvertedExpr ( ) = e
2297
+ )
2298
+ }
2299
+
2291
2300
/**
2292
2301
* Gets an expression node that is safely guarded by the given guard check.
2293
2302
*
@@ -2321,9 +2330,8 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
2321
2330
* NOTE: If an indirect expression is tracked, use `getAnIndirectBarrierNode` instead.
2322
2331
*/
2323
2332
Node getABarrierNode ( ) {
2324
- exists ( IRGuardCondition g , Expr e , ValueNumber value , boolean edge |
2325
- e = value .getAnInstruction ( ) .getConvertedResultExpression ( ) and
2326
- result .asConvertedExpr ( ) = e and
2333
+ exists ( IRGuardCondition g , ValueNumber value , boolean edge |
2334
+ convertedExprHasValueNumber ( value , result ) and
2327
2335
guardChecks ( g ,
2328
2336
pragma [ only_bind_into ] ( value .getAnInstruction ( ) .getConvertedResultExpression ( ) ) , edge ) and
2329
2337
controls ( g , result , edge )
@@ -2374,6 +2382,17 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
2374
2382
*/
2375
2383
Node getAnIndirectBarrierNode ( ) { result = getAnIndirectBarrierNode ( _) }
2376
2384
2385
+ bindingset [ value, n]
2386
+ pragma [ inline_late]
2387
+ private predicate indirectConvertedExprHasValueNumber (
2388
+ int indirectionIndex , ValueNumber value , Node n
2389
+ ) {
2390
+ exists ( Expr e |
2391
+ e = value .getAnInstruction ( ) .getConvertedResultExpression ( ) and
2392
+ n .asIndirectConvertedExpr ( indirectionIndex ) = e
2393
+ )
2394
+ }
2395
+
2377
2396
/**
2378
2397
* Gets an indirect expression node with indirection index `indirectionIndex` that is
2379
2398
* safely guarded by the given guard check.
@@ -2409,9 +2428,8 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
2409
2428
* NOTE: If a non-indirect expression is tracked, use `getABarrierNode` instead.
2410
2429
*/
2411
2430
Node getAnIndirectBarrierNode ( int indirectionIndex ) {
2412
- exists ( IRGuardCondition g , Expr e , ValueNumber value , boolean edge |
2413
- e = value .getAnInstruction ( ) .getConvertedResultExpression ( ) and
2414
- result .asIndirectConvertedExpr ( indirectionIndex ) = e and
2431
+ exists ( IRGuardCondition g , ValueNumber value , boolean edge |
2432
+ indirectConvertedExprHasValueNumber ( indirectionIndex , value , result ) and
2415
2433
guardChecks ( g ,
2416
2434
pragma [ only_bind_into ] ( value .getAnInstruction ( ) .getConvertedResultExpression ( ) ) , edge ) and
2417
2435
controls ( g , result , edge )
@@ -2450,12 +2468,20 @@ private EdgeKind getConditionalEdge(boolean branch) {
2450
2468
* in data flow and taint tracking.
2451
2469
*/
2452
2470
module InstructionBarrierGuard< instructionGuardChecksSig / 3 instructionGuardChecks> {
2471
+ bindingset [ value, n]
2472
+ pragma [ inline_late]
2473
+ private predicate operandHasValueNumber ( ValueNumber value , Node n ) {
2474
+ exists ( Operand use |
2475
+ use = value .getAnInstruction ( ) .getAUse ( ) and
2476
+ n .asOperand ( ) = use
2477
+ )
2478
+ }
2479
+
2453
2480
/** Gets a node that is safely guarded by the given guard check. */
2454
2481
Node getABarrierNode ( ) {
2455
- exists ( IRGuardCondition g , ValueNumber value , boolean edge , Operand use |
2482
+ exists ( IRGuardCondition g , ValueNumber value , boolean edge |
2456
2483
instructionGuardChecks ( g , pragma [ only_bind_into ] ( value .getAnInstruction ( ) ) , edge ) and
2457
- use = value .getAnInstruction ( ) .getAUse ( ) and
2458
- result .asOperand ( ) = use and
2484
+ operandHasValueNumber ( value , result ) and
2459
2485
controls ( g , result , edge )
2460
2486
)
2461
2487
or
0 commit comments