@@ -421,7 +421,7 @@ module AccessPath {
421
421
}
422
422
423
423
/**
424
- * A module for reasoning dominating reads and writes to access-paths.
424
+ * A module for reasoning dominating reads and writes to access-paths.
425
425
*/
426
426
module DominatingPaths {
427
427
/**
@@ -463,15 +463,14 @@ module AccessPath {
463
463
( path = fromRhs ( result , root ) or result = root .getAPropertyWrite ( path ) ) and
464
464
type = AccessPathWrite ( )
465
465
}
466
-
466
+
467
467
/**
468
- * Gets a basicblock that is domminated by a assignment to an access-path identified by `root` and `path`.
468
+ * Gets a basic-block where the access path defined by `root` and `path` is written to.
469
+ * And a read to the same access path exists.
469
470
*/
470
- private ReachableBasicBlock getADominatedBlock ( Root root , string path ) {
471
- getAccessTo ( root , path , AccessPathWrite ( ) )
472
- .getBasicBlock ( )
473
- .( ReachableBasicBlock )
474
- .strictlyDominates ( result )
471
+ private ReachableBasicBlock getAWriteBlock ( Root root , string path ) {
472
+ result = getAccessTo ( root , path , AccessPathWrite ( ) ) .getBasicBlock ( ) and
473
+ exists ( getAccessTo ( root , path , AccessPathRead ( ) ) ) // helps performance
475
474
}
476
475
477
476
/**
@@ -490,7 +489,7 @@ module AccessPath {
490
489
// across basic blocks.
491
490
exists ( Root root , string path |
492
491
read = getAccessTo ( root , path , AccessPathRead ( ) ) and
493
- read . getBasicBlock ( ) = getADominatedBlock ( root , path )
492
+ getAWriteBlock ( root , path ) . strictlyDominates ( read . getBasicBlock ( ) )
494
493
)
495
494
}
496
495
}
0 commit comments