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 03:08:13PM +0200, Eric Botcazou wrote:
> > No, they are ref-all before gimplification.
> 
> I meant that you're explicitly casting the addresses to ref-all types:
> 
>     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>>>>>
> 
> so <pointer_type 0xf7daa850> is presumably not ref-all.

True, but that really doesn't make any difference.

      desttype = build_pointer_type_for_mode (TREE_TYPE (destvar),
                                              ptr_mode, true);
#if 1
      destvar = build_fold_addr_expr_with_type (destvar, desttype);
#else
      destvar = build_fold_addr_expr (destvar);
      destvar = fold_convert (desttype, destvar);
#endif
      destvar = build1 (INDIRECT_REF, TREE_TYPE (desttype), destvar);

      srctype = build_pointer_type_for_mode (TREE_TYPE (srcvar),
                                             ptr_mode, true);
#if 1
      srcvar = build_fold_addr_expr_with_type (srcvar, srctype);
#else
      srcvar = build_fold_addr_expr (srcvar);
      srcvar = fold_convert (srctype, srcvar);
#endif
      srcvar = build1 (INDIRECT_REF, TREE_TYPE (srctype), srcvar);

is what I have been trying first and the result is exactly the same in the end,
although there is no NOP_EXPR and already the ADDR_EXPR has the ref-all pointer type.

(gdb) p debug_tree (destvar)
 <indirect_ref 0xf7db2440
    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 <addr_expr 0xf7db2420
        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 <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>>>>
(gdb) p debug_tree (srcvar)
 <indirect_ref 0xf7db2480
    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 <addr_expr 0xf7db2460
        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 <component_ref 0xf7dac1e0 type <pointer_type 0xf7daa4d0>
            arg 0 <var_decl 0xf7daa5b0 t> arg 1 <field_decl 0xf7daa540 t>>>>

	Jakub


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