From: Jonas Fietz Date: Thu, 20 May 2010 15:02:27 +0000 (+0000) Subject: Fix a bug in comparison evaluation X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=c7423b9349a4a6652ea4035f72363a947ac59a3a;hp=ea7d4bf45d9be3e4bd804cdd20652b85ff6abaf2;p=libfirm Fix a bug in comparison evaluation VRP/jumpthreading: In the case of a calculated Lg-eval, the optimization sometimes assumed a false result. [r27568] --- diff --git a/ir/opt/jumpthreading.c b/ir/opt/jumpthreading.c index 945ca526b..3f9e42e6d 100644 --- a/ir/opt/jumpthreading.c +++ b/ir/opt/jumpthreading.c @@ -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; } /**