This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21712] missed optimization due with const function and pulling out of loops
- From: "rakdver at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 May 2005 21:36:20 -0000
- Subject: [Bug tree-optimization/21712] missed optimization due with const function and pulling out of loops
- References: <20050522191803.21712.TazForEver@dlfp.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rakdver at gcc dot gnu dot org 2005-05-22 21:36 -------
Do you still believe we should move gettype2 out of the loop???
#define CONST __attribute__((const))
int get_type1(void) CONST;
int get_type2(void) CONST;
void* cast(void*, int) CONST;
void do_something(void*);
void baz(void* p)
{
while(1)
{
do_something(cast(p, get_type1()));
do_something(cast(p, get_type2()));
}
}
void do_something(void)
{
exit(0);
}
int gettype2(void)
{
int i, s = 0;
for (i = 0; i < 1000000; i++)
s += just_waste_time (i);
return s;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21712