[Bug optimization/2806] if's are not combined together
law at redhat dot com
gcc-bugzilla@gcc.gnu.org
Fri Mar 5 03:53:00 GMT 2004
------- 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
More information about the Gcc-bugs
mailing list