re PR ipa/64153 (r218205 miscompiles libgomp)
authorMartin Jambor <mjambor@suse.cz>
Wed, 3 Dec 2014 14:05:51 +0000 (15:05 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 3 Dec 2014 14:05:51 +0000 (15:05 +0100)
2014-12-03  Martin Jambor  <mjambor@suse.cz>

PR ipa/64153
* ipa-inline-analysis.c (evaluate_conditions_for_known_args): Check
type sizes before view_converting.

From-SVN: r218316

gcc/ChangeLog
gcc/ipa-inline-analysis.c

index 2e9d9c6c99a1403f6b6eea9a06827dc7e09d4258..610606494cd931a7d012ae11c30ba813e62e6f49 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-03  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/64153
+       * ipa-inline-analysis.c (evaluate_conditions_for_known_args): Check
+       type sizes before view_converting.
+
 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR rtl-optimization/64151
index 71b56fda62e81c40d71de67c1eeb4b43135f8208..a2500d0c06ba5e64967060012dc875483212e3b3 100644 (file)
@@ -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;