From 2f35958cd5f5a303446e390cf532b4b1b0500c16 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Wed, 3 Dec 2014 15:05:51 +0100 Subject: [PATCH] re PR ipa/64153 (r218205 miscompiles libgomp) 2014-12-03 Martin Jambor PR ipa/64153 * ipa-inline-analysis.c (evaluate_conditions_for_known_args): Check type sizes before view_converting. From-SVN: r218316 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-inline-analysis.c | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2e9d9c6c99a..610606494cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-12-03 Martin Jambor + + PR ipa/64153 + * ipa-inline-analysis.c (evaluate_conditions_for_known_args): Check + type sizes before view_converting. + 2014-12-03 H.J. Lu PR rtl-optimization/64151 diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 71b56fda62e..a2500d0c06b 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -880,12 +880,19 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, } if (c->code == IS_NOT_CONSTANT || c->code == CHANGED) continue; - val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (c->val), val); - res = val - ? fold_binary_to_constant (c->code, boolean_type_node, val, c->val) - : NULL; - if (res && integer_zerop (res)) - continue; + + if (operand_equal_p (TYPE_SIZE (TREE_TYPE (c->val)), + TYPE_SIZE (TREE_TYPE (val)), 0)) + { + val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (c->val), val); + + res = val + ? fold_binary_to_constant (c->code, boolean_type_node, val, c->val) + : NULL; + + if (res && integer_zerop (res)) + continue; + } clause |= 1 << (i + predicate_first_dynamic_condition); } return clause; -- 2.30.2