@@ -474,20 +474,29 @@ pragma[nomagic]
474
474
private predicate barrierGuardBlocksEdge (
475
475
BarrierGuardNode guard , DataFlow:: Node pred , DataFlow:: Node succ , string label
476
476
) {
477
- barrierGuardIsRelevant ( guard ) and
478
477
exists (
479
478
SsaVariable input , SsaPhiNode phi , BasicBlock bb , ConditionGuardNode cond , boolean outcome
480
479
|
480
+ bb = getADominatedBasicBlock ( guard , cond ) and
481
481
pred = DataFlow:: ssaDefinitionNode ( input ) and
482
482
succ = DataFlow:: ssaDefinitionNode ( phi ) and
483
483
input = phi .getInputFromBlock ( bb ) and
484
- guard .getEnclosingExpr ( ) = cond .getTest ( ) and
485
484
outcome = cond .getOutcome ( ) and
486
- barrierGuardBlocksExpr ( guard , outcome , input .getAUse ( ) , label ) and
487
- cond .dominates ( bb )
485
+ barrierGuardBlocksExpr ( guard , outcome , input .getAUse ( ) , label )
488
486
)
489
487
}
490
488
489
+ /**
490
+ * Gets a basicblock that is dominated by `cond`, where the test for `cond` cond is `guard`.
491
+ *
492
+ * This predicate exists to get a better join-order for the `barrierGuardBlocksEdge` predicate above.
493
+ */
494
+ private BasicBlock getADominatedBasicBlock ( BarrierGuardNode guard , ConditionGuardNode cond ) {
495
+ barrierGuardIsRelevant ( guard ) and
496
+ guard .getEnclosingExpr ( ) = cond .getTest ( ) and
497
+ cond .dominates ( result )
498
+ }
499
+
491
500
/**
492
501
* Holds if there is a barrier edge `pred -> succ` in `cfg` either through an explicit barrier edge
493
502
* or one implied by a barrier guard.
0 commit comments