@@ -2495,11 +2495,35 @@ module InstructionBarrierGuard<instructionGuardChecksSig/3 instructionGuardCheck
2495
2495
)
2496
2496
}
2497
2497
2498
+ bindingset [ value, n]
2499
+ pragma [ inline_late]
2500
+ private predicate indirectOperandHasValueNumber ( ValueNumber value , int indirectionIndex , Node n ) {
2501
+ exists ( Operand use |
2502
+ use = value .getAnInstruction ( ) .getAUse ( ) and
2503
+ n .asIndirectOperand ( indirectionIndex ) = use
2504
+ )
2505
+ }
2506
+
2498
2507
/**
2499
2508
* Gets an indirect node with indirection index `indirectionIndex` that is
2500
2509
* safely guarded by the given guard check.
2501
2510
*/
2502
- Node getAnIndirectBarrierNode ( int indirectionIndex ) { none ( ) }
2511
+ Node getAnIndirectBarrierNode ( int indirectionIndex ) {
2512
+ exists ( IRGuardCondition g , ValueNumber value , boolean edge |
2513
+ instructionGuardChecks ( g , pragma [ only_bind_into ] ( value .getAnInstruction ( ) ) , edge ) and
2514
+ indirectOperandHasValueNumber ( value , indirectionIndex , result ) and
2515
+ controls ( g , result , edge )
2516
+ )
2517
+ or
2518
+ exists (
2519
+ IRGuardCondition g , boolean branch , Ssa:: DefinitionExt def , IRBlock input , Ssa:: PhiNode phi
2520
+ |
2521
+ instructionGuardChecks ( g , def .getARead ( ) .asIndirectOperand ( indirectionIndex ) .getDef ( ) , branch ) and
2522
+ guardControlsPhiInput ( g , branch , def , pragma [ only_bind_into ] ( input ) ,
2523
+ pragma [ only_bind_into ] ( phi ) ) and
2524
+ result = TSsaPhiInputNode ( phi , input )
2525
+ )
2526
+ }
2503
2527
}
2504
2528
2505
2529
/**
0 commit comments