This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: stabilize switch labels for -fcompare-debug in vrp
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 11 Oct 2010 16:09:05 +0200
- Subject: Re: stabilize switch labels for -fcompare-debug in vrp
- References: <or4ocsvq0e.fsf@livre.localdomain>
On Mon, Oct 11, 2010 at 3:05 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
> 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?
Well. Quoting tree.h:
/* A numeric unique identifier for a LABEL_DECL. The UID allocation is
dense, unique within any one function, and may be used to index arrays.
If the value is -1, then no UID has been assigned. */
#define LABEL_DECL_UID(NODE) \
(LABEL_DECL_CHECK (NODE)->label_decl.label_decl_uid)
and if the labels get a different DECL_UID I see no reason why they
shouldn't get a different LABEL_DECL_UID.
So no, I don't think this is an improvement. Instead we need to understand
why the LABEL_DECL gets a different uid.
Richard.