@@ -2275,7 +2275,7 @@ private predicate guardControlsPhiInput(
22752275 */
22762276signature predicate guardChecksSig ( IRGuardCondition g , Expr e , boolean branch ) ;
22772277
2278- bindingset [ g, n ]
2278+ bindingset [ g]
22792279pragma [ inline_late]
22802280private predicate controls ( IRGuardCondition g , Node n , boolean edge ) {
22812281 g .controls ( n .getBasicBlock ( ) , edge )
@@ -2288,6 +2288,15 @@ private predicate controls(IRGuardCondition g, Node n, boolean edge) {
22882288 * in data flow and taint tracking.
22892289 */
22902290module 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+
22912300 /**
22922301 * Gets an expression node that is safely guarded by the given guard check.
22932302 *
@@ -2321,9 +2330,8 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
23212330 * NOTE: If an indirect expression is tracked, use `getAnIndirectBarrierNode` instead.
23222331 */
23232332 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
23272335 guardChecks ( g ,
23282336 pragma [ only_bind_into ] ( value .getAnInstruction ( ) .getConvertedResultExpression ( ) ) , edge ) and
23292337 controls ( g , result , edge )
@@ -2374,6 +2382,17 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
23742382 */
23752383 Node getAnIndirectBarrierNode ( ) { result = getAnIndirectBarrierNode ( _) }
23762384
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+
23772396 /**
23782397 * Gets an indirect expression node with indirection index `indirectionIndex` that is
23792398 * safely guarded by the given guard check.
@@ -2409,9 +2428,8 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
24092428 * NOTE: If a non-indirect expression is tracked, use `getABarrierNode` instead.
24102429 */
24112430 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
24152433 guardChecks ( g ,
24162434 pragma [ only_bind_into ] ( value .getAnInstruction ( ) .getConvertedResultExpression ( ) ) , edge ) and
24172435 controls ( g , result , edge )
@@ -2450,12 +2468,20 @@ private EdgeKind getConditionalEdge(boolean branch) {
24502468 * in data flow and taint tracking.
24512469 */
24522470module 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+
24532480 /** Gets a node that is safely guarded by the given guard check. */
24542481 Node getABarrierNode ( ) {
2455- exists ( IRGuardCondition g , ValueNumber value , boolean edge , Operand use |
2482+ exists ( IRGuardCondition g , ValueNumber value , boolean edge |
24562483 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
24592485 controls ( g , result , edge )
24602486 )
24612487 or
0 commit comments