public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Restrict keyword doesn't work correctly in GCC 4.4
@ 2009-06-03 10:42 Bingfeng Mei
  2009-06-03 10:53 ` Richard Guenther
  0 siblings, 1 reply; 6+ messages in thread
From: Bingfeng Mei @ 2009-06-03 10:42 UTC (permalink / raw)
  To: gcc

Hello, 
I noticed that the restrict doesn't work fully on 4.4.0 (used to work on
 our port based on 4.3 branch). The problem is that tree optimizer can do a
lot of optimization regarding pointer, e.g., at -O3. The alias set property
is not propagated accordingly. 

Is the following RTL expansion correct? Both read and write address are
converted to a restrict pointer, but the both mem rtx have the same alias set (2). 

;; *(int * restrict) (D.1768 + 4) = *(int * restrict) (D.1770 + 4);

(insn 56 55 57 tst.c:7 (set (reg:SI 124)
        (mem:SI (plus:SI (reg:SI 103 [ D.1770 ])
                (const_int 4 [0x4])) [2 S4 A32])) -1 (nil))

(insn 57 56 0 tst.c:7 (set (mem:SI (plus:SI (reg:SI 104 [ D.1768 ])
                (const_int 4 [0x4])) [2 S4 A32])
        (reg:SI 124)) -1 (nil))


The alias set property is copied from tree node:
 <indirect_ref 0xf7f09d40
    type <integer_type 0xf7f122f4 int sizes-gimplified public SI
        size <integer_cst 0xf7f0f9d8 constant 32>
        unit size <integer_cst 0xf7f0f7c4 constant 4>
        align 32 symtab 0 alias set 2 canonical type 0xf7f122f4 precision 32 min <integer_cst 0xf7f0f984 -2147483648> max <integer_cst 0xf7f0f9a0 2147483647>
        pointer_to_this <pointer_type 0xf7f18798>>
   
    arg 0 <nop_expr 0xf7fc7400
        type <pointer_type 0xf7fa6870 type <integer_type 0xf7f122f4 int>
            sizes-gimplified public unsigned restrict SI size <integer_cst 0xf7f0f9d8 32> unit size <integer_cst 0xf7f0f7c4 4>
            align 32 symtab 0 alias set -1 canonical type 0xf7fa6870>
       
        arg 0 <plus_expr 0xf7fc95e8 type <integer_type 0xf7f12438 long unsigned int>
            arg 0 <var_decl 0xf7fc4a6c D.1768>
            arg 1 <integer_cst 0xf7fb7bec constant 4>
            tst.c:7:5>
        tst.c:7:5>
    tst.c:7:5>

Is the RTL expansion wrong or the orginal tree node is constructed incorrectly? 

Thanks,
Bingfeng Mei

Broadcom UK

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-03 15:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-03 10:42 Restrict keyword doesn't work correctly in GCC 4.4 Bingfeng Mei
2009-06-03 10:53 ` Richard Guenther
2009-06-03 11:02   ` Bingfeng Mei
2009-06-03 14:09     ` Richard Guenther
2009-06-03 15:35       ` Bingfeng Mei
2009-06-03 15:46         ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).