This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Optimizing silly ELSE clauses
- From: law at redhat dot com
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 14 Aug 2003 12:08:11 -0600
- Subject: Re: [tree-ssa] Optimizing silly ELSE clauses
- Reply-to: law at redhat dot com
In message <20030814174530.GF12623@redhat.com>, Richard Henderson writes:
>On Thu, Aug 14, 2003 at 09:23:09AM -0600, law@redhat.com wrote:
>> * tree-cfg.c (remove_useless_stmts_and_vars): For a COND_EXPR
>> where the condition is a variable and the ELSE clause merely
>> sets that variable to zero, remove the ELSE clause.
>
>This seems like a hack, since it won't trigger if you had to
>do anything else in that ELSE clause.
True, it is somewhat of a hack. But those are also the only cases I've
seen where it's actually mattered.
>It would appear that a better solution is to catch this *before*
>the out-of-ssa pass and transform the PHI to
>
> var.3 = PHI (var.2, var.1);
>
>Yes, this partially reverts what CCP has done, but oh well. If
>we don't allow CCP to propagate the zero into the PHI, we don't
>get the opportunity to prove the PHI is constant.
And if you do that, then you lose in cases were the conditional isn't
testing "var". If you try to make it dependent on the condition, then
you're getting into the realm of a gross hack in the out-of-ssa pass.
jeff