This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/16913] [3.5 Regression] restrict does not make a different
- From: "zhangjie at magima dot com dot cn" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Aug 2004 03:33:07 -0000
- Subject: [Bug tree-optimization/16913] [3.5 Regression] restrict does not make a different
- References: <20040807114151.16913.martin@mpa-garching.mpg.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From zhangjie at magima dot com dot cn 2004-08-18 03:33 -------
I'm investigating this. It seems that gcc failed to get the correct alias set
for b[j+N/4]. Current get_alias_set () uses find_base_decl () to find the base
pointer that the address pointer expression depends on. But when the pointer
expression has been gimplified, find_base_decl () cannot follow the ud chains to
find the true base pointer. My initial thought is replace find_base_decl with
something that can walk ud chains to find the true base pointer.
And When I looked tts t04.generic dump
foo (a, b, n, j)
{
unsigned int i.0;
unsigned int T.1;
float * restrict T.2;
float * restrict T.3;
unsigned int j.4;
unsigned int T.5;
float * restrict T.6;
float * restrict T.7;
float * restrict T.8;
float T.9;
float * restrict T.10;
float T.11;
float T.12;
float T.13;
int i;
i = 0;
goto <D1042>;
<D1041>:;
i.0 = (unsigned int)i;
T.1 = i.0 * 4;
T.2 = (float * restrict)T.1;
T.3 = T.2 + a;
j.4 = (unsigned int)j;
T.5 = j.4 * 4;
T.6 = (float * restrict)T.5;
T.7 = T.6 + b;
T.8 = T.7 + 200B;
T.9 = *T.8;
j.4 = (unsigned int)j;
T.5 = j.4 * 4;
T.6 = (float * restrict)T.5;
T.7 = T.6 + b;
T.10 = T.7 - 200B;
T.11 = *T.10;
T.12 = T.9 + T.11;
T.13 = T.12 * 5.0e-1;
*T.3 = T.13;
i = i + 1;
<D1042>:;
if (i < n)
{
goto <D1041>;
}
else
{
goto <D1043>;
}
<D1043>:;
}
I found it was rather weird that "T.1" was first cast to (float * restrict)
before it was added with "a". I think it's better to directly add the index to
"a" without the cast. I asked this on the gcc mailing list with a simpler case
<http://gcc.gnu.org/ml/gcc/2004-08/msg00700.html>.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16913