Hello, At least in GCC 4.2.1, it prints out "restrict" in gimple format so that I can track how restrict is passed along optimizations. But it disapprears in GCC 4.3.0
tst.c.004t.gimple produced by GCC 4.3.0 tst2 (a, b, c) { unsigned int i.0; unsigned int D.1591; V2W * D.1592; V2W * D.1593; vector int D.1594; V2W * D.1595; vector int D.1596; vector int D.1597; int i; i = 0; goto <D.1588>; <D.1587>:; i.0 = (unsigned int) i; D.1591 = i.0 * 8; D.1592 = c + D.1591; i.0 = (unsigned int) i; D.1591 = i.0 * 8; D.1593 = a + D.1591; D.1594 = *D.1593; i.0 = (unsigned int) i; D.1591 = i.0 * 8; D.1595 = b + D.1591; D.1596 = *D.1595; D.1597 = D.1594 + D.1596; *D.1592 = D.1597; i = i + 1; <D.1588>:; if (i <= 255) { goto <D.1587>; } else { goto <D.1589>; } <D.1589>:; } tst.c.004t.gimple produced by GCC 4.2.1 tst2 (a, b, c) { unsigned int i.0; unsigned int D.1891; V2W * D.1892; V2W * D.1893; V2W * D.1894; vector int D.1895; V2W * D.1896; vector int D.1897; vector int D.1898; int i; i = 0; goto <D1888>; <D1887>:; i.0 = (unsigned int) i; D.1891 = i.0 * 8; D.1892 = (V2W * restrict) D.1891; D.1893 = D.1892 + c; i.0 = (unsigned int) i; D.1891 = i.0 * 8; D.1892 = (V2W * restrict) D.1891; D.1894 = D.1892 + a; D.1895 = *D.1894; i.0 = (unsigned int) i; D.1891 = i.0 * 8; D.1892 = (V2W * restrict) D.1891; D.1896 = D.1892 + b; D.1897 = *D.1896; D.1898 = D.1895 + D.1897; *D.1893 = D.1898; i = i + 1; <D1888>:; if (i <= 255) { goto <D1887>; } else { goto <D1889>; } <D1889>:; } > At the RTL level, restrict ends up being transformed into a different alias set. Could you elaborate a little bit more? Which function/structure should I look at? I tried to grep restrict/alias/.., no much clue. Thanks. Bingfeng Mei -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Berlin Sent: 15 April 2008 18:03 To: Bingfeng Mei Cc: gcc@gcc.gnu.org Subject: Re: Where is restrict keyword used in dependence analysis? On Tue, Apr 15, 2008 at 12:01 PM, Bingfeng Mei <[EMAIL PROTECTED]> wrote: > Hello, > > I am porting to GCC 4.3.0 for our VLIW processor, and try to utilize > improved restrict keyword support. Somehow, I find for normal data > types, including vector types up to 8bytes, the restrict keyword works > just fine. But for wider vector, such as 4 32-bit word type, the > restrict keyword doesn't work any more. For example, for the first two > following functions, compiler can unroll (-funroll-all-loops) loops and > produces good schedule, where load instructions of next iteration can be > moved beyond store instruction of this iteration. But for the third > example, it is different. As suggested in .sched2 file, the compiler can > only resolve dependence of next load instructions after store > instruction of this iteration is scheduled. I tried to print out > tree-ssa files by using -fdump-tree-all. Unliked previous GCC (4.2.1), > the information in those files is not helpful at all. How not? If we don't know, we can't fix them :) > I don't know > where to look at now. Could someone point me some files/functions/data > structures by which restrict keyword is used and passed to dependence > anaylsis part? Thanks in advance. You mean the dependence analysis used by the scheduler? That stuff is in sched-deps.c At the RTL level, restrict ends up being transformed into a different alias set. At the tree level, restrict info is not used very much right now. > Example code: > > typedef int V4W __attribute__ ((vector_size (16))); > typedef int V2W __attribute__ ((vector_size (8))); > > void tst(int * restrict a, int * restrict b, int * restrict c) > { > int i; > for(i = 0; i < 256; i++){ > c[i] = a[i] + b[i]; > } > } > > void tst2(int * restrict a, int * restrict b, int * restrict c) > { > int i; > for(i = 0; i < 256; i++){ > c[i] = a[i] + b[i]; > } > } > > void tst3(V4W * restrict a, V4W * restrict b, V4W * restrict c) > { > int i; > for(i = 0; i < 256; i++){ > c[i] = a[i] + b[i]; > } > } > > >