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: Richard Henderson <rth at redhat dot com>
- To: law at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 14 Aug 2003 10:45:30 -0700
- Subject: Re: [tree-ssa] Optimizing silly ELSE clauses
- References: <200308141523.h7EFNAQZ032004@speedy.slc.redhat.com>
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.
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.
r~