------- Additional Comments From dberlin at gcc dot gnu dot org  2005-08-18 
13:09 -------
Subject: Re:  New: load PRE is missing

On Thu, 2005-08-18 at 07:55 +0000, bonzini at gcc dot gnu dot org wrote:
> Load PRE is scheduled for 4.2, I'm creating this bug because load PRE is
> currently split between CSE and GCSE (this bug blocks the "optimizations 
> caught
> by CSE" meta-bug, PR19721).  Given this code,
> 
>    unsigned outcnt;
>    extern void flush_outbuf(void);
> 
>    void
>    bi_windup(unsigned char *outbuf, unsigned char bi_buf)
>    {
>        outbuf[outcnt] = bi_buf;
>        if (outcnt == 16384)
>                flush_outbuf();
>        outbuf[outcnt] = bi_buf;
>    }
>    
> we'd want the code to become
> 
>     void
>     bi_windup(unsigned char *outbuf, unsigned char bi_buf)
>     {
>         int t1 = outcnt;
>         outbuf[t1] = bi_buf;
>         int t2 = outcnt, t3;
>         if (t2 == 16384) {
>                 flush_outbuf();
>               t3 = outcnt;
>       } else
>               t3 = t2;
>         outbuf[t3] = bi_buf;
>     }
> 

This doesn't remove a single load.
In fact, i'm not sure what you think is better about this code.

However, it certainly won't be caught by load PRE.




-- 


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

Reply via email to