This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
attribute pure and gcse
- From: Dara Hazeghi <dhazeghi at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 2 Apr 2004 19:17:07 -0800 (PST)
- Subject: attribute pure and gcse
Hello,
according to the gcc 3.3 manual, functions marked pure
should be candidates for common subexpression
elimination.
In the following case (which seems a good candidate),
the second call to square is not eliminated by gcse
(leastaways not with 3.3 on ppc). Is this expected, or
should cse be doing better here?
int square(int a) __attribute__ ((pure));
int square(int a)
{
int j=0;
while(j!=a)
{
a = j*a;
j++;
}
return a;
}
int main()
{
return square(2) * square(2);
}
Thanks,
Dara
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/