This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/23455] load PRE is missing
- From: "dberlin at dberlin dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Aug 2005 13:10:14 -0000
- Subject: [Bug tree-optimization/23455] load PRE is missing
- References: <20050818075555.23455.bonzini@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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