On Wed, Jun 3, 2009 at 12:41 PM, Bingfeng Mei <b...@broadcom.com> wrote: > 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);
restrict only works if there is a restrict qualified pointer decl in your source. I will re-implement restrict support completely for 4.5. You can try the attached hack which might help (but also cause weird effects ...). Richard. > (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 >
p
Description: Binary data