File tree Expand file tree Collapse file tree
test/library-tests/controlflow/guards-ir Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -310,7 +310,7 @@ class IRGuardCondition extends Instruction {
310310 succ .dominates ( controlled ) and
311311 forall ( IRBlock pred
312312 | pred .getASuccessor ( ) = succ
313- | pred = thisblock or succ .dominates ( pred ) ) ) ) // removed reachability condition - is that OK?
313+ | pred = thisblock or succ .dominates ( pred ) or not pred . isReachableFromFunctionEntry ( ) ) ) )
314314 }
315315}
316316
Original file line number Diff line number Diff line change @@ -89,4 +89,12 @@ class IRBlock extends TIRBlock {
8989 dominates ( result .getAPredecessor ( ) ) and
9090 not strictlyDominates ( result )
9191 }
92+
93+ /**
94+ * Holds if this block is reachable from the entry point of its function
95+ */
96+ final predicate isReachableFromFunctionEntry ( ) {
97+ this = getFunctionIR ( ) .getEntryBlock ( ) or
98+ getAPredecessor ( ) .isReachableFromFunctionEntry ( )
99+ }
92100}
Original file line number Diff line number Diff line change @@ -89,4 +89,12 @@ class IRBlock extends TIRBlock {
8989 dominates ( result .getAPredecessor ( ) ) and
9090 not strictlyDominates ( result )
9191 }
92+
93+ /**
94+ * Holds if this block is reachable from the entry point of its function
95+ */
96+ final predicate isReachableFromFunctionEntry ( ) {
97+ this = getFunctionIR ( ) .getEntryBlock ( ) or
98+ getAPredecessor ( ) .isReachableFromFunctionEntry ( )
99+ }
92100}
Original file line number Diff line number Diff line change @@ -89,4 +89,12 @@ class IRBlock extends TIRBlock {
8989 dominates ( result .getAPredecessor ( ) ) and
9090 not strictlyDominates ( result )
9191 }
92+
93+ /**
94+ * Holds if this block is reachable from the entry point of its function
95+ */
96+ final predicate isReachableFromFunctionEntry ( ) {
97+ this = getFunctionIR ( ) .getEntryBlock ( ) or
98+ getAPredecessor ( ) .isReachableFromFunctionEntry ( )
99+ }
92100}
Original file line number Diff line number Diff line change 8787| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 |
8888| test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 |
8989| test.cpp:31:7:31:13 | ... == ... | true | 31 | 32 |
90+ | test.cpp:42:13:42:20 | call to getABool | false | 53 | 53 |
9091| test.cpp:42:13:42:20 | call to getABool | true | 43 | 45 |
Original file line number Diff line number Diff line change 8282| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 |
8383| test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 |
8484| test.cpp:31:7:31:13 | ... == ... | true | 32 | 32 |
85+ | test.cpp:42:13:42:20 | call to getABool | false | 53 | 53 |
8586| test.cpp:42:13:42:20 | call to getABool | true | 44 | 44 |
You can’t perform that action at this time.
0 commit comments