@@ -2380,6 +2380,15 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
2380
2380
*/
2381
2381
Node getAnIndirectBarrierNode ( ) { result = getAnIndirectBarrierNode ( _) }
2382
2382
2383
+ bindingset [ value, n]
2384
+ pragma [ inline_late]
2385
+ private predicate indirectConvertedExprHasValueNumber (
2386
+ Expr e , int indirectionIndex , ValueNumber value , Node n
2387
+ ) {
2388
+ e = value .getAnInstruction ( ) .getConvertedResultExpression ( ) and
2389
+ n .asIndirectConvertedExpr ( indirectionIndex ) = e
2390
+ }
2391
+
2383
2392
/**
2384
2393
* Gets an indirect expression node with indirection index `indirectionIndex` that is
2385
2394
* safely guarded by the given guard check.
@@ -2416,8 +2425,7 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
2416
2425
*/
2417
2426
Node getAnIndirectBarrierNode ( int indirectionIndex ) {
2418
2427
exists ( IRGuardCondition g , Expr e , ValueNumber value , boolean edge |
2419
- e = value .getAnInstruction ( ) .getConvertedResultExpression ( ) and
2420
- result .asIndirectConvertedExpr ( indirectionIndex ) = e and
2428
+ indirectConvertedExprHasValueNumber ( e , indirectionIndex , value , result ) and
2421
2429
guardChecks ( g ,
2422
2430
pragma [ only_bind_into ] ( value .getAnInstruction ( ) .getConvertedResultExpression ( ) ) , edge ) and
2423
2431
controls ( g , result , edge )
@@ -2456,12 +2464,18 @@ private EdgeKind getConditionalEdge(boolean branch) {
2456
2464
* in data flow and taint tracking.
2457
2465
*/
2458
2466
module InstructionBarrierGuard< instructionGuardChecksSig / 3 instructionGuardChecks> {
2467
+ bindingset [ value, n]
2468
+ pragma [ inline_late]
2469
+ private predicate operandHasValueNumber ( Operand use , ValueNumber value , Node n ) {
2470
+ use = value .getAnInstruction ( ) .getAUse ( ) and
2471
+ n .asOperand ( ) = use
2472
+ }
2473
+
2459
2474
/** Gets a node that is safely guarded by the given guard check. */
2460
2475
Node getABarrierNode ( ) {
2461
2476
exists ( IRGuardCondition g , ValueNumber value , boolean edge , Operand use |
2462
2477
instructionGuardChecks ( g , pragma [ only_bind_into ] ( value .getAnInstruction ( ) ) , edge ) and
2463
- use = value .getAnInstruction ( ) .getAUse ( ) and
2464
- result .asOperand ( ) = use and
2478
+ operandHasValueNumber ( use , value , result ) and
2465
2479
controls ( g , result , edge )
2466
2480
)
2467
2481
or
0 commit comments