This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Incorrect bitfield aliasing with Tree SSA


On 6/17/07, Richard Kenner <kenner@vlsi1.ultra.nyu.edu> wrote:
> This is fine.
>
> Any "value" we can get from DECL_NONADRESSABLE_P, we will get through
> handling it explicitly when pruning.
>
> > Adam
> >
> >         * alias.c (record_component_aliases): Call record_alias_subset for
> >         DECL_NONADDRESSABLE_P fields too.

No.  Once you've subsetted it in this way, you lose most of the value
of it!  The main reason for the flag is precisely for the usage that is
proposed being eliminated here.

But anything other than the patch above is simply lying to the alias system.


Not marking them as a subset means that given:

struct foo {int a:31; int b:1} bar, *barp = &bar;

bar->a and bar->b *cannot access* bar.a and bar.b.

This is simply wrong.

You then try to fix this up later with
"component_uses_parent_alias_set" and such, but it's simply wrong
information in the first place.

The reality is these accesses conflict.

If you are attempting to achieve some optimization of bit fields based
on the fact that you can't do &bar.x, *this is not the way to do it*.

The way to do that is to say, when you look at when you random
pointers,  "oh, these can't touch the bitfields" (IE somewhere in the
per-store/load aliasing queries).

Right now, because you aren't recording it as a subset, we believe a
pointer to the *structure* can't alias them.

Again, the right thing to do is to keep the alias set information
correct, and optimize the special cases on a per-access basis.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]