This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta, vta4.4] no alias set information for MEMs in debug insns
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 18 Aug 2009 16:33:42 -0300
- Subject: [vta, vta4.4] no alias set information for MEMs in debug insns
Here's a fix for another -fcompare-debug problem: while expanding debug
insns, MEMs are created that sometimes reference types or variables that
hadn't got an alias set.
This causes the alias set counters to go out of sync between -g and -g0
compiles. I couldn't find any single case in which this difference in
alias set numbering caused codegen differences, but it is wasteful and
pointless to grow the alias set vector because of debug insns, and the
different memory attributes in the final insn dump, caused by the
out-of-sync alias sets, causes -fcompare-debug failures.
The fix was to disable strict aliasing while expanding debug insns.
This leaves alias set information (computed or to be computed) intact in
variables and types while filling in the alias set information in memory
attributes in newly-generated DEBUG_INSNs with zero, which works just
fine.
I'm installing this in the VTA and VTA4.4 branches.
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* cfgexpand.c (expand_debug_locations): Temporarily disable
strict aliasing during expansion.
Index: gcc/cfgexpand.c
===================================================================
--- gcc/cfgexpand.c.orig 2009-08-05 05:04:03.000000000 -0300
+++ gcc/cfgexpand.c 2009-08-18 06:30:13.000000000 -0300
@@ -2907,6 +2907,12 @@ expand_debug_locations (void)
{
rtx insn;
rtx last = get_last_insn ();
+ int save_strict_alias = flag_strict_aliasing;
+
+ /* New alias sets while setting up memory attributes cause
+ -fcompare-debug failures, even though it doesn't bring about any
+ codegen changes. */
+ flag_strict_aliasing = 0;
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
if (DEBUG_INSN_P (insn))
@@ -2939,6 +2945,8 @@ expand_debug_locations (void)
INSN_VAR_LOCATION_LOC (insn) = val;
}
+
+ flag_strict_aliasing = save_strict_alias;
}
/* Expand basic block BB from GIMPLE trees to RTL. */
--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist Red Hat Brazil Compiler Engineer