@@ -612,14 +612,11 @@ private Ssa::Definition getAnSsaQualifier(Expr e, ControlFlow::Node cfn) {
612612}
613613
614614private AssignableAccess getATrackedAccess ( Ssa:: Definition def , ControlFlow:: Node cfn ) {
615- (
616- result = def .getAReadAtNode ( cfn )
617- or
618- result = def .( Ssa:: ExplicitDefinition ) .getADefinition ( ) .getTargetAccess ( ) and
619- result .getAControlFlowNode ( ) = cfn and
620- cfn .getBasicBlock ( ) = def .getBasicBlock ( )
621- ) and
615+ result = def .getAReadAtNode ( cfn ) and
622616 not def instanceof Ssa:: ImplicitUntrackedDefinition
617+ or
618+ result = def .( Ssa:: ExplicitDefinition ) .getADefinition ( ) .getTargetAccess ( ) and
619+ cfn = def .getControlFlowNode ( )
623620}
624621
625622/**
@@ -962,68 +959,13 @@ module Internal {
962959 e = any ( BinaryArithmeticOperation bao | result = bao .getAnOperand ( ) )
963960 }
964961
965- pragma [ noinline]
966- private predicate assertionControlsNodeInSameBasicBlock0 (
967- Guard g , AbstractValue v , BasicBlock bb , int i
968- ) {
969- exists ( Assertion a , Guard g0 , AbstractValue v0 |
970- asserts ( a , g0 , v0 ) and
971- impliesSteps ( g0 , v0 , g , v ) and
972- bb .getNode ( i ) = a .getAControlFlowNode ( )
973- )
974- }
975-
976- /**
977- * Holds if control flow node `cfn` only is reached when guard `g` evaluates to `v`,
978- * because of an assertion.
979- */
980- private predicate assertionControlsNodeInSameBasicBlock (
981- Guard g , ControlFlow:: Node cfn , AbstractValue v
982- ) {
983- exists ( BasicBlock bb , int i , int j |
984- assertionControlsNodeInSameBasicBlock0 ( g , v , bb , i ) and
985- bb .getNode ( j ) = cfn and
986- j > i
987- )
988- }
989-
990- /**
991- * Holds if control flow element `cfe` only is reached when guard `g` evaluates to `v`,
992- * because of an assertion.
993- */
994- private predicate guardAssertionControlsElement ( Guard g , ControlFlowElement cfe , AbstractValue v ) {
995- forex ( ControlFlow:: Node cfn | cfn = cfe .getAControlFlowNode ( ) |
996- assertionControlsNodeInSameBasicBlock ( g , cfn , v )
997- )
998- }
999-
1000962 /** Same as `this.getAChildExpr*()`, but avoids `fastTC`. */
1001963 private Expr getAChildExprStar ( Guard g ) {
1002964 result = g
1003965 or
1004966 result = getAChildExprStar ( g ) .getAChildExpr ( )
1005967 }
1006968
1007- /**
1008- * Holds if assertion `a` directly asserts that expression `e` evaluates to value `v`.
1009- */
1010- predicate asserts ( Assertion a , Expr e , AbstractValue v ) {
1011- e = a .getExpr ( ) and
1012- (
1013- a .getAssertMethod ( ) instanceof AssertTrueMethod and
1014- v .( BooleanValue ) .getValue ( ) = true
1015- or
1016- a .getAssertMethod ( ) instanceof AssertFalseMethod and
1017- v .( BooleanValue ) .getValue ( ) = false
1018- or
1019- a .getAssertMethod ( ) instanceof AssertNullMethod and
1020- v .( NullValue ) .isNull ( )
1021- or
1022- a .getAssertMethod ( ) instanceof AssertNonNullMethod and
1023- v .( NullValue ) .isNonNull ( )
1024- )
1025- }
1026-
1027969 private Expr stripConditionalExpr ( Expr e ) {
1028970 e =
1029971 any ( ConditionalExpr ce |
@@ -1453,8 +1395,6 @@ module Internal {
14531395 or
14541396 val .branch ( _, _, e )
14551397 or
1456- asserts ( _, e , val )
1457- or
14581398 e instanceof CollectionExpr and
14591399 val = TEmptyCollectionValue ( _)
14601400 ) and
@@ -1767,11 +1707,7 @@ module Internal {
17671707 pragma [ noinline]
17681708 private predicate candidateAux ( AccessOrCallExpr e , Declaration target , BasicBlock bb ) {
17691709 target = e .getTarget ( ) and
1770- exists ( Guard g | e = getAChildExprStar ( g ) |
1771- guardControls ( g , bb , _)
1772- or
1773- assertionControlsNodeInSameBasicBlock ( g , bb .getANode ( ) , _)
1774- )
1710+ exists ( Guard g | e = getAChildExprStar ( g ) | guardControls ( g , bb , _) )
17751711 }
17761712 }
17771713
@@ -1786,11 +1722,6 @@ module Internal {
17861722 exists ( ControlFlowElement cfe , ConditionalSuccessor s |
17871723 v0 .branch ( cfe , s , g0 ) and cfe .controlsBlock ( bb , s )
17881724 )
1789- or
1790- exists ( Assertion a |
1791- asserts ( a , g0 , v0 ) and
1792- a .strictlyDominates ( bb )
1793- )
17941725 )
17951726 }
17961727
@@ -1812,9 +1743,6 @@ module Internal {
18121743 forex ( ControlFlow:: Node cfn | cfn = guarded .getAControlFlowNode ( ) |
18131744 isGuardedByNode0 ( cfn , guarded , g , sub , v )
18141745 )
1815- or
1816- guardAssertionControlsElement ( g , guarded , v ) and
1817- exists ( ConditionOnExprComparisonConfig c | c .same ( sub , guarded ) )
18181746 }
18191747
18201748 private predicate adjacentReadPairSameVarUniquePredecessor (
@@ -1848,9 +1776,6 @@ module Internal {
18481776 ControlFlow:: Nodes:: ElementNode guarded , Guard g , AccessOrCallExpr sub , AbstractValue v
18491777 ) {
18501778 isGuardedByNode0 ( guarded , _, g , sub , v )
1851- or
1852- assertionControlsNodeInSameBasicBlock ( g , guarded , v ) and
1853- exists ( ConditionOnExprComparisonConfig c | c .same ( sub , guarded .getElement ( ) ) )
18541779 }
18551780
18561781 pragma [ noinline]
0 commit comments