This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Better comparison of BINFOs in IPA-CP
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Mon, 5 Sep 2011 09:24:36 +0200
- Subject: Re: [PATCH] Better comparison of BINFOs in IPA-CP
- References: <20110903223915.GA8174@virgil.arch.suse.de>
> Hi,
>
> the patch below improves the comparisons of BINFOs in IPA-CP. The
> problem is that we can read different BINFOs for the same type (or a
> base type component) from the LTO summaries because BINFOs coming from
> different compilation units are not unified. Because we now have the
> BINFO_VTABLE available, we can compare those instead since the VMT
> variables are unified.
Hmm, I was quite sure this is happening. Can't you get an extra credit for unifying
the binfos at stream in?
Honza
>
> Bootstrapped and tested on x86_64-linux, also tested by LTO-building
> Firefox and 483.xalancbmk on the same platform (I lost the actual
> numbers but the new test returned true hundreds of times in both
> these cases). OK for trunk?
>
> Thanks,
>
> Martin
>
>
> 2011-09-02 Martin Jambor <mjambor@suse.cz>
>
> * ipa-cp.c (values_equal_for_ipcp_p): When comparing BINFOs, compare
> their BINFO_VTABLE,
>
> Index: src/gcc/ipa-cp.c
> ===================================================================
> --- src.orig/gcc/ipa-cp.c
> +++ src/gcc/ipa-cp.c
> @@ -800,6 +800,33 @@ values_equal_for_ipcp_p (tree x, tree y)
> if (x == y)
> return true;
>
> + if (TREE_CODE (x) == TREE_BINFO && TREE_CODE (y) == TREE_BINFO)
> + {
> + unsigned HOST_WIDE_INT ox, oy;
> + tree vx = BINFO_VTABLE (x);
> + tree vy = BINFO_VTABLE (y);
> +
> + if (!vx || !vy
> + || TREE_CODE (vx) != POINTER_PLUS_EXPR
> + || TREE_CODE (vy) != POINTER_PLUS_EXPR)
> + return false;
> +
> + ox = tree_low_cst (TREE_OPERAND (vx, 1), 1);
> + oy = tree_low_cst (TREE_OPERAND (vx, 1), 1);
> +
> + if (ox != oy)
> + return false;
> +
> + vx = TREE_OPERAND (vx, 0);
> + vy = TREE_OPERAND (vy, 0);
> + if (TREE_CODE (vx) != ADDR_EXPR
> + || TREE_CODE (vy) != ADDR_EXPR)
> + return false;
> +
> + if (TREE_OPERAND (vx, 0) == TREE_OPERAND (vy, 0))
> + return true;
> + }
> +
> if (TREE_CODE (x) == TREE_BINFO || TREE_CODE (y) == TREE_BINFO)
> return false;
>