@@ -776,7 +776,9 @@ private predicate unary_compares_eq(
776
776
Instruction test , Operand op , int k , boolean areEqual , boolean inNonZeroCase , AbstractValue value
777
777
) {
778
778
/* The simple case where the test *is* the comparison so areEqual = testIsTrue xor eq. */
779
- exists ( AbstractValue v | unary_simple_comparison_eq ( test , op , k , inNonZeroCase , v ) |
779
+ exists ( AbstractValue v |
780
+ unary_simple_comparison_eq ( test , k , inNonZeroCase , v ) and op .getDef ( ) = test
781
+ |
780
782
areEqual = true and value = v
781
783
or
782
784
areEqual = false and value = v .getDualValue ( )
@@ -844,11 +846,10 @@ private predicate relevantUnaryComparison(Instruction test) {
844
846
* Rearrange various simple comparisons into `op == k` form.
845
847
*/
846
848
private predicate unary_simple_comparison_eq (
847
- Instruction test , Operand op , int k , boolean inNonZeroCase , AbstractValue value
849
+ Instruction test , int k , boolean inNonZeroCase , AbstractValue value
848
850
) {
849
851
exists ( SwitchInstruction switch , CaseEdge case |
850
852
test = switch .getExpression ( ) and
851
- op .getDef ( ) = test and
852
853
case = value .( MatchValue ) .getCase ( ) and
853
854
exists ( switch .getSuccessor ( case ) ) and
854
855
case .getValue ( ) .toInt ( ) = k and
@@ -913,7 +914,8 @@ private predicate compares_lt(
913
914
914
915
/** Holds if `op < k` evaluates to `isLt` given that `test` evaluates to `value`. */
915
916
private predicate compares_lt ( Instruction test , Operand op , int k , boolean isLt , AbstractValue value ) {
916
- simple_comparison_lt ( test , op , k , isLt , value )
917
+ unary_simple_comparison_lt ( test , k , isLt , value ) and
918
+ op .getDef ( ) = test
917
919
or
918
920
complex_lt ( test , op , k , isLt , value )
919
921
or
@@ -960,12 +962,11 @@ private predicate simple_comparison_lt(CompareInstruction cmp, Operand left, Ope
960
962
}
961
963
962
964
/** Rearrange various simple comparisons into `op < k` form. */
963
- private predicate simple_comparison_lt (
964
- Instruction test , Operand op , int k , boolean isLt , AbstractValue value
965
+ private predicate unary_simple_comparison_lt (
966
+ Instruction test , int k , boolean isLt , AbstractValue value
965
967
) {
966
968
exists ( SwitchInstruction switch , CaseEdge case |
967
969
test = switch .getExpression ( ) and
968
- op .getDef ( ) = test and
969
970
case = value .( MatchValue ) .getCase ( ) and
970
971
exists ( switch .getSuccessor ( case ) ) and
971
972
case .getMaxValue ( ) > case .getMinValue ( )
0 commit comments