This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/2806] if's are not combined together
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Mar 2004 03:53:27 -0000
- Subject: [Bug optimization/2806] if's are not combined together
- References: <20010511150601.2806.eric-gcc@omnifarious.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From law at redhat dot com 2004-03-05 03:53 -------
Subject: Re: if's are not combined together
In message <20040304030605.4965.qmail@sources.redhat.com>, "pinskia at gcc dot
gnu dot org" writes:
>
>------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-04 0
>3:06 -------
>We are now missing one jump threading for some reason:
>(From .DOM3):
>{
><bb 0>:
> if (eax_1 == 65535) goto <L0>; else goto <L6>;
>
><L0>:;
> if (edx_2 == 1) goto <L1>; else goto <L4>;
>
><L1>:;
> abarney[0] = 5;
> abarney[1] = 6;
>
><L4>:;
> edx_3 = edx_2 - 1;
> if (edx_3 == 0) goto <L5>; else goto <L6>;
>
><L5>:;
> afred[0] = 2;
>
><L6>:;
> return;
OK. edx_3 is a single use variable and we can (in theory) propagate it into
the conditional and adjust the conditional. ie
if (edx_3 == 0)
can be turned into
if (edx_2 == 1)
Once that's done, then the jump threader can thread through that block.
I've got a patch which does that as a straightforward extension to
tree-ssa-forwprop. I'm still evaluating whether or not I want to risk
introducing it now or wait until after we merge.
On a positive note, with that improvement to tree-ssa-forwprop tree-ssa
generates noticeably better code than the mainline GCC sources.
jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2806