This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
stabilize switch labels for -fcompare-debug in vrp
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 11 Oct 2010 10:05:21 -0300
- Subject: stabilize switch labels for -fcompare-debug in vrp
i386.c fails -fcompare-debug at -O3 because label half: in
ix86_expand_vector_init_general gets the DECL_UIDs of labels sorted
differently by the tree-vrp sort function.
As a result, different SSA_NAMEs are used for the assert variables in
different cases of the switch. At the end of VRP, they're released, and
put in the freelist in different order. At a later pass, the SSA_NAME
nodes are reused in a different order, and we go down the hill from
there, because different version numbers cause other optimization
differences.
Using LABEL_DECL_UIDs instead of DECL_UIDs gets us a stable sort. I
haven't figured out why the named label got a different UID. I only
observed this in the 4.5 branch, but the same patch applies cleanly in
the trunk, and I regstrapped the patch on both trees, on x86 and on
x86_64.
Ok to install?
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* tree-vrp.c (compare_case_labels): Use LABEL_DECL_UID.
Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c.orig 2010-10-08 07:36:36.668853265 -0300
+++ gcc/tree-vrp.c 2010-10-08 07:42:52.872769933 -0300
@@ -4658,8 +4658,8 @@ compare_case_labels (const void *p1, con
{
const_tree const case1 = *(const_tree const*)p1;
const_tree const case2 = *(const_tree const*)p2;
- unsigned int uid1 = DECL_UID (CASE_LABEL (case1));
- unsigned int uid2 = DECL_UID (CASE_LABEL (case2));
+ unsigned int uid1 = LABEL_DECL_UID (CASE_LABEL (case1));
+ unsigned int uid2 = LABEL_DECL_UID (CASE_LABEL (case2));
if (uid1 < uid2)
return -1;
--
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