This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix optimization regression in constant folder
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 Sep 2007 15:39:26 +0200
- Subject: [PATCH] Fix optimization regression in constant folder
Hi,
The fix for PR middle-end/30364 disabled association of expressions with more
than 1 variable if the type doesn't wrap. This is a bit problematic for Ada
because variable-sized types generate lots of size calculations and we want
to simplify them at compile time as much as possible.
Bootstrapped/regtested on i586-suse-linux, OK for mainline?
2007-09-17 Eric Botcazou <ebotcazou@adacore.com>
* fold-const.c (fold_binary): Associate again expressions with more
than one variable for size types.
--
Eric Botcazou
Index: fold-const.c
===================================================================
--- fold-const.c (revision 128432)
+++ fold-const.c (working copy)
@@ -9924,10 +9924,13 @@ fold_binary (enum tree_code code, tree t
var1 = split_tree (arg1, code, &con1, &lit1, &minus_lit1,
code == MINUS_EXPR);
- /* With undefined overflow we can only associate constants
- with one variable. */
+ /* With undefined overflow we can only associate constants with one
+ variable, but this restriction doesn't apply to size types. */
if ((POINTER_TYPE_P (type)
- || (INTEGRAL_TYPE_P (type) && !TYPE_OVERFLOW_WRAPS (type)))
+ || (INTEGRAL_TYPE_P (type)
+ && !TYPE_OVERFLOW_WRAPS (type)
+ && !(TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (type))))
&& var0 && var1)
{
tree tmp0 = var0;