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: [PATCH] Fix the one entry mem{{,p}cpy,move,set} optimization aliasing issues (PR middle-end/29272)


On Wed, Oct 04, 2006 at 01:37:55PM +0200, Eric Botcazou wrote:
> > When I use just build1 rather than fold_build_indirect_ref I get the IMHO
> > right one:
> >
> > ;; Function foo (foo)
> > ;; enabled by -tree-original
> > {
> >   struct T * p = (struct T *) s;
> >
> >     struct T * p = (struct T *) s;
> >   *(struct T * * {ref-all}) &p->t = *(struct T * * {ref-all}) &t.t;, (void
> > *) &p->t;; }
> >
> > for the 29272 testcase.  But already at *.gimple that's bad again:
> >
> > foo (s)
> > {
> >   struct T * D.1530;
> >   struct T * p;
> >
> >   p = (struct T *) s;
> >   D.1530 = t.t;
> >   p->t = D.1530;
> > }
> >
> > and no ref-all in sight.
> 
> Yes, your pointers are not ref-all from the beginning.

No, they are ref-all before gimplification.
The exact trees in fold_builtin_memory_op after the few added lines are:
(gdb) p debug_tree (destvar)
 <indirect_ref 0xf7db2460
    type <pointer_type 0xf7daa4d0
        type <record_type 0xf7daa460 T type_0 SI
            size <integer_cst 0xf7ce7880 constant invariant 32>
            unit size <integer_cst 0xf7ce7540 constant invariant 4>
            align 32 symtab 0 alias set -1 fields <field_decl 0xf7daa540 t>
            pointer_to_this <pointer_type 0xf7daa4d0> chain <type_decl 0xf7cf7c00 D.1523>>
        unsigned SI size <integer_cst 0xf7ce7880 32> unit size <integer_cst 0xf7ce7540 4>
        align 32 symtab 0 alias set -1
        pointer_to_this <pointer_type 0xf7daa930>>

    arg 0 <nop_expr 0xf7db2440
        type <pointer_type 0xf7daa930 type <pointer_type 0xf7daa4d0>
            static unsigned SI size <integer_cst 0xf7ce7880 32> unit size <integer_cst 0xf7ce7540 4>
            align 32 symtab 0 alias set -1>

        arg 0 <addr_expr 0xf7db2420 type <pointer_type 0xf7daa850>

            arg 0 <component_ref 0xf7dac1b0 type <pointer_type 0xf7daa4d0>

                arg 0 <indirect_ref 0xf7db2220 type <record_type 0xf7daa460 T>
                    arg 0 <var_decl 0xf7daa7e0 p>> arg 1 <field_decl 0xf7daa540 t>>>>>
$1 = void
(gdb) p debug_tree (srcvar)
 <indirect_ref 0xf7db24c0
    type <pointer_type 0xf7daa4d0
        type <record_type 0xf7daa460 T type_0 SI
            size <integer_cst 0xf7ce7880 constant invariant 32>
            unit size <integer_cst 0xf7ce7540 constant invariant 4>
            align 32 symtab 0 alias set -1 fields <field_decl 0xf7daa540 t>
            pointer_to_this <pointer_type 0xf7daa4d0> chain <type_decl 0xf7cf7c00 D.1523>>
        unsigned SI size <integer_cst 0xf7ce7880 32> unit size <integer_cst 0xf7ce7540 4>
        align 32 symtab 0 alias set -1
        pointer_to_this <pointer_type 0xf7daa930>>

    arg 0 <nop_expr 0xf7db24a0
        type <pointer_type 0xf7daa930 type <pointer_type 0xf7daa4d0>
            static unsigned SI size <integer_cst 0xf7ce7880 32> unit size <integer_cst 0xf7ce7540 4>
            align 32 symtab 0 alias set -1>
        constant invariant
        arg 0 <addr_expr 0xf7db2480 type <pointer_type 0xf7daa850>
            constant invariant
            arg 0 <component_ref 0xf7dac1e0 type <pointer_type 0xf7daa4d0>
                arg 0 <var_decl 0xf7daa5b0 t> arg 1 <field_decl 0xf7daa540 t>>>>>

The 0xf7daa930 pointer type has static_flag set (aka ref-all).

	Jakub


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