From c7423b9349a4a6652ea4035f72363a947ac59a3a Mon Sep 17 00:00:00 2001 From: Jonas Fietz Date: Thu, 20 May 2010 15:02:27 +0000 Subject: [PATCH] Fix a bug in comparison evaluation VRP/jumpthreading: In the case of a calculated Lg-eval, the optimization sometimes assumed a false result. [r27568] --- ir/opt/jumpthreading.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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; } /** -- 2.20.1