[Bug tree-optimization/21712] missed optimization due with const function and pulling out of loops

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun May 22 21:34:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-22 21:34 -------
Then if you say it is expensive, why do we move the divide above 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, ((int)p)/4));
        }
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21712



More information about the Gcc-bugs mailing list