This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] disable tree_swap_operands_p when optimizing for size infold-const.c
- From: Gábor Lóki <alga at rgai dot hu>
- To: roger at eyesopen dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 15 Oct 2003 13:37:18 +0200
- Subject: [PATCH] disable tree_swap_operands_p when optimizing for size infold-const.c
The http://gcc.gnu.org/ml/gcc-patches/2003-09/msg02012.html patch
modified the tree_swap_operands_p function which created about 0,15%
bigger object sizes.
The mechanism of the patch shouldn't be used when optimizing for size.
See the code size increment on CSiBE latest or advanced pages
http://sed.inf.u-szeged.hu/CSiBE/
The following patch disables the heuristics when optimizing for size.
I measured the size benefit for five targets of the patch with CSiBE
(positive value means smaller object sizes in the size benefit column).
mainline(b) patched(b) size benefit(%)
arm 1 155 557 1 153 285 0,196%
i386 993 726 992 970 0,076%
m68k 970 890 969 688 0,124%
mips 1 226 812 1 225 272 0,126%
ppc 1 157 223 1 155 215 0,174%
Tested with a "make check-gcc" on arm-elf.
Ok for mainline?
2003-10-15 Gábor Lóki <alga@rgai.hu>
* fold-const.c (tree_swap_operands_p): disables
some features when optimizing for size
Index: gcc/gcc/fold-const.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.313
diff -c -3 -p -r1.313 fold-const.c
*** gcc/gcc/fold-const.c 11 Oct 2003 21:15:08 -0000 1.313
--- gcc/gcc/fold-const.c 15 Oct 2003 08:27:29 -0000
*************** tree_swap_operands_p (tree arg0, tree ar
*** 5148,5153 ****
--- 5148,5156 ----
return 0;
if (TREE_CONSTANT (arg0))
return 1;
+
+ if (optimize_size)
+ return 0;
if (reorder && flag_evaluation_order
&& (TREE_SIDE_EFFECTS (arg0) || TREE_SIDE_EFFECTS (arg1)))