summaryrefslogtreecommitdiff
path: root/gcc/tree-chrec.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-03-20 12:39:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-03-20 12:39:32 +0000
commit3da3ff4e712aad4d79949ce2875e8748b799c95b (patch)
tree149b988f26d1e4b2d318e3c64d83f270f9e11aba /gcc/tree-chrec.c
parent1e039275b5781ba03565686eb723cb834919819a (diff)
downloadgcc-3da3ff4e712aad4d79949ce2875e8748b799c95b.tar.gz
re PR tree-optimization/64715 (__builtin_object_size (..., 1) fails to locate subobject)
2015-03-20 Richard Biener <rguenther@suse.de> PR middle-end/64715 * tree-chrec.c (chrec_fold_poly_cst): Use useless_type_conversion_p for type comparison and gcc_checking_assert. (chrec_fold_plus_poly_poly): Likewise. (chrec_fold_multiply_poly_poly): Likewise. (chrec_convert_1): Likewise. * gimplify.c (gimplify_expr): Remove premature folding of &X + CST to &MEM[&X, CST]. * gcc.dg/pr15347.c: Use -O. * c-c++-common/pr19807-1.c: Likewise. From-SVN: r221532
Diffstat (limited to 'gcc/tree-chrec.c')
-rw-r--r--gcc/tree-chrec.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 84ba30e4e92..b599c2c3e5e 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -78,8 +78,8 @@ chrec_fold_poly_cst (enum tree_code code,
gcc_assert (poly);
gcc_assert (cst);
gcc_assert (TREE_CODE (poly) == POLYNOMIAL_CHREC);
- gcc_assert (!is_not_constant_evolution (cst));
- gcc_assert (type == chrec_type (poly));
+ gcc_checking_assert (!is_not_constant_evolution (cst));
+ gcc_checking_assert (useless_type_conversion_p (type, chrec_type (poly)));
switch (code)
{
@@ -124,10 +124,11 @@ chrec_fold_plus_poly_poly (enum tree_code code,
gcc_assert (TREE_CODE (poly0) == POLYNOMIAL_CHREC);
gcc_assert (TREE_CODE (poly1) == POLYNOMIAL_CHREC);
if (POINTER_TYPE_P (chrec_type (poly0)))
- gcc_assert (ptrofftype_p (chrec_type (poly1)));
+ gcc_checking_assert (ptrofftype_p (chrec_type (poly1))
+ && useless_type_conversion_p (type, chrec_type (poly0)));
else
- gcc_assert (chrec_type (poly0) == chrec_type (poly1));
- gcc_assert (type == chrec_type (poly0));
+ gcc_checking_assert (useless_type_conversion_p (type, chrec_type (poly0))
+ && useless_type_conversion_p (type, chrec_type (poly1)));
/*
{a, +, b}_1 + {c, +, d}_2 -> {{a, +, b}_1 + c, +, d}_2,
@@ -208,8 +209,8 @@ chrec_fold_multiply_poly_poly (tree type,
gcc_assert (poly1);
gcc_assert (TREE_CODE (poly0) == POLYNOMIAL_CHREC);
gcc_assert (TREE_CODE (poly1) == POLYNOMIAL_CHREC);
- gcc_assert (chrec_type (poly0) == chrec_type (poly1));
- gcc_assert (type == chrec_type (poly0));
+ gcc_checking_assert (useless_type_conversion_p (type, chrec_type (poly0))
+ && useless_type_conversion_p (type, chrec_type (poly1)));
/* {a, +, b}_1 * {c, +, d}_2 -> {c*{a, +, b}_1, +, d}_2,
{a, +, b}_2 * {c, +, d}_1 -> {a*{c, +, d}_1, +, b}_2,
@@ -1352,7 +1353,7 @@ chrec_convert_1 (tree type, tree chrec, gimple at_stmt,
return chrec;
ct = chrec_type (chrec);
- if (ct == type)
+ if (useless_type_conversion_p (type, ct))
return chrec;
if (!evolution_function_is_affine_p (chrec))