Fix a bug in comparison evaluation
authorJonas Fietz <fietz@ipd.info.uni-karlsruhe.de>
Thu, 20 May 2010 15:02:27 +0000 (15:02 +0000)
committerJonas Fietz <fietz@ipd.info.uni-karlsruhe.de>
Thu, 20 May 2010 15:02:27 +0000 (15:02 +0000)
VRP/jumpthreading: In the case of a calculated Lg-eval, the optimization sometimes assumed a false
result.

[r27568]

ir/opt/jumpthreading.c

index 945ca52..3f9e42e 100644 (file)
@@ -385,13 +385,16 @@ static int eval_cmp_tv(pn_Cmp pnc, tarval *tv_left, tarval *tv_right)
 static int eval_cmp_vrp(pn_Cmp pnc, ir_node *left, ir_node *right)
 {
        pn_Cmp cmp_result = vrp_cmp(left, right);
-
        /* does the compare evaluate to true? */
-       if (cmp_result == pn_Cmp_False)
+       if (cmp_result == pn_Cmp_False) {
                return -1;
-       if ((cmp_result & pnc) != cmp_result)
+       }
+       if ((cmp_result & pnc) != cmp_result) {
+               if ((cmp_result & pnc) != 0) {
+                       return -1;
+               }
                return 0;
-
+       }
        return 1;
 }
 /**