@@ -776,7 +776,9 @@ private predicate unary_compares_eq(
776776 Instruction test , Operand op , int k , boolean areEqual , boolean inNonZeroCase , AbstractValue value
777777) {
778778 /* 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+ |
780782 areEqual = true and value = v
781783 or
782784 areEqual = false and value = v .getDualValue ( )
@@ -844,11 +846,10 @@ private predicate relevantUnaryComparison(Instruction test) {
844846 * Rearrange various simple comparisons into `op == k` form.
845847 */
846848private 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
848850) {
849851 exists ( SwitchInstruction switch , CaseEdge case |
850852 test = switch .getExpression ( ) and
851- op .getDef ( ) = test and
852853 case = value .( MatchValue ) .getCase ( ) and
853854 exists ( switch .getSuccessor ( case ) ) and
854855 case .getValue ( ) .toInt ( ) = k and
@@ -913,7 +914,8 @@ private predicate compares_lt(
913914
914915/** Holds if `op < k` evaluates to `isLt` given that `test` evaluates to `value`. */
915916private 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
917919 or
918920 complex_lt ( test , op , k , isLt , value )
919921 or
@@ -960,12 +962,11 @@ private predicate simple_comparison_lt(CompareInstruction cmp, Operand left, Ope
960962}
961963
962964/** 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
965967) {
966968 exists ( SwitchInstruction switch , CaseEdge case |
967969 test = switch .getExpression ( ) and
968- op .getDef ( ) = test and
969970 case = value .( MatchValue ) .getCase ( ) and
970971 exists ( switch .getSuccessor ( case ) ) and
971972 case .getMaxValue ( ) > case .getMinValue ( )
0 commit comments