This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/14753] [tree-ssa] some missed forward propagation opportunities
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 May 2004 19:04:21 -0000
- Subject: [Bug optimization/14753] [tree-ssa] some missed forward propagation opportunities
- References: <20040327161347.14753.kazu@cs.umass.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From law at redhat dot com 2004-05-04 19:04 -------
Subject: Re: [tree-ssa] some missed forward
propagation opportunities
In message <20040331024237.14588.qmail@sources.redhat.com>, "kazu at cs dot uma
ss dot edu" writes:
>
>------- Additional Comments From kazu at cs dot umass dot edu 2004-03-31 02:
>42 -------
>One more case.
>
>void bar (void);
>
>void
>foo (unsigned int a)
>{
> if ((a >> 5) & 1)
> bar ();
>}
>
>I get:
>
>foo (a)
>{
> _Bool T.2;
> unsigned int T.1;
> unsigned int T.0;
>
><bb 0>:
> T.0_2 = a_1 >> 5;
> T.1_3 = T.0_2 & 1;
> T.2_4 = (_Bool)T.1_3;
> if (T.2_4) goto <L0>; else goto <L1>;
>
><L0>:;
> bar () [tail call];
>
><L1>:;
> return;
>
>}
>
>We could have "if (T.1_3 != 0)".
>If nothing else, we can eliminate one temporary variable.
Well, not only do we get to eliminate a temporary, we then have the ability
to propagate T.1_3 == 0 on one arm of the branch.
It's a pretty trivial extension to the existing forward propagation code
[ It's the inversion of propagating from a TRUTH_NOT_EXPR. ]
On hold pending a merge into the mainline.
jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14753