aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-03-17 14:34:21 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-03-17 14:34:21 +0000
commitc4e5b5a8bf81daa9e21c17149a4943b96c8099b3 (patch)
tree953f8e21808467a87b2490c396b2f654c4d588ca /gcc/fold-const.c
parentec286fe7ab26dbfeeb7e7d05d9d747745c108393 (diff)
downloadgcc-c4e5b5a8bf81daa9e21c17149a4943b96c8099b3.zip
gcc-c4e5b5a8bf81daa9e21c17149a4943b96c8099b3.tar.gz
gcc-c4e5b5a8bf81daa9e21c17149a4943b96c8099b3.tar.bz2
re PR tree-optimization/19637 (Missed VRP and FRE opportunities in the presence of casts)
2008-03-17 Richard Guenther <rguenther@suse.de> PR tree-optimization/19637 * fold-const.c (fold_unary): Remove restrictions of removing intermediate pointer-conversions (P2)(P1)P0. * tree-ssa-ccp.c (maybe_fold_stmt_addition): Recover from conversion to void pointer. (get_maxval_strlen): Handle addresses of the form &(*p)[0]. * g++.dg/tree-ssa/pr19637.C: New testcase. From-SVN: r133291
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 4dc4ad7..3bfe52e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7784,9 +7784,7 @@ fold_unary (enum tree_code code, tree type, tree op0)
- the initial type is a pointer type and the precisions of the
intermediate and final types differ, or
- the final type is a pointer type and the precisions of the
- initial and intermediate types differ.
- - the initial type is a pointer to an array and the final type
- not. */
+ initial and intermediate types differ. */
if (! inside_float && ! inter_float && ! final_float
&& ! inside_vec && ! inter_vec && ! final_vec
&& (inter_prec >= inside_prec || inter_prec >= final_prec)
@@ -7798,10 +7796,7 @@ fold_unary (enum tree_code code, tree type, tree op0)
&& ! (inside_ptr && inter_prec != final_prec)
&& ! (final_ptr && inside_prec != inter_prec)
&& ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (type))
- && TYPE_MODE (type) == TYPE_MODE (inter_type))
- && ! (inside_ptr && final_ptr
- && TREE_CODE (TREE_TYPE (inside_type)) == ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE))
+ && TYPE_MODE (type) == TYPE_MODE (inter_type)))
return fold_build1 (code, type, TREE_OPERAND (op0, 0));
}