From: Matthias Braun Date: Wed, 29 Aug 2012 16:41:21 +0000 (+0200) Subject: improve value_not_zero X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=66998639af90e1fee264d4b9ce0566b82a3072eb;p=libfirm improve value_not_zero SymConst_addr_ent are never zero for example, also there's no need to give up after seeing a confirm --- diff --git a/ir/opt/opt_confirms.c b/ir/opt/opt_confirms.c index 817ebe726..dc67eaf05 100644 --- a/ir/opt/opt_confirms.c +++ b/ir/opt/opt_confirms.c @@ -120,8 +120,10 @@ int value_not_zero(const ir_node *n, const ir_node **confirm) * without the fear that is might be hidden by a further Confirm. */ tv = value_of(get_Confirm_bound(n)); - if (tv == tarval_bad) - return 0; + if (tv == tarval_bad) { + n = get_Confirm_value(n); + continue; + } relation = tarval_cmp(tv, get_mode_null(mode)); @@ -151,10 +153,13 @@ int value_not_zero(const ir_node *n, const ir_node **confirm) } n = get_Confirm_value(n); } - tv = value_of(n); + /* global entities are never NULL */ + if (is_SymConst_addr_ent(n)) + return true; + tv = value_of(n); if (tv == tarval_bad) - return 0; + return false; relation = tarval_cmp(tv, get_mode_null(mode));