This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
- From: "dberlin at dberlin dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Aug 2006 14:43:26 -0000
- Subject: [Bug tree-optimization/15452] [tree-ssa] Optimize cascaded a = a == 0;
- References: <bug-15452-5009@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from dberlin at gcc dot gnu dot org 2006-08-24 14:43 -------
Subject: Re: [tree-ssa] Optimize cascaded a
= a == 0;
pinskia at gcc dot gnu dot org wrote:
> ------- Comment #6 from pinskia at gcc dot gnu dot org 2006-08-24 04:27 -------
> Another interesting case would be (but which could be handled by VRP):
> int
> foo (int a)
> {
> a = a!=0;
> a = a!=0;
> a = a!=0;
> a = a!=0;
> a = a!=0;
> return a;
> }
> Which should be optimized to:
> int foo(int a) { return a!=0;}
>
>
Uh, FRE could also optimize this to the same thing, I just don't
remember whether it bothers to look at conditionals as eliminable
expressions.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15452