This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/23286] missed fully redundant expression
- From: "dberlin at dberlin dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Aug 2005 20:29:41 -0000
- Subject: [Bug tree-optimization/23286] missed fully redundant expression
- References: <20050808174631.23286.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-08 20:29 -------
Subject: Re: missed fully redundant expression
On Mon, 2005-08-08 at 19:54 +0000, pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-08 19:54 -------
> Here is a stupid testcase which can be sped up by pulling the reduandant expressions up:
> int ii;
> static inline int f(int i, int ii)
> {
> return i/ ii;
> }
>
> int h(int) __attribute__((pure,const));
>
> int g(int i)
> {
> int j, j1 = i;
> for (j = 0; j <1000; j++)
> {
> int ii1 = ii;
> if (h(j))
> i = j1/ii1 + 2;
> else
> i = j1/ii1;
> }
> return i;
> }
>
Yes, if we hoisted this, we would then pull it out of the loop.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23286