This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Optimizing silly ELSE clauses


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]