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: [RFC] Use fold to do phi optimizations


I would say instead of using fold, can you instead pull out the COND_EXPR folding from fold
and put it into a function called fold_cond_expr which returns NULL if it cannot do the
folding and takes four arguments (type, condition, true_part, false_part) and then just use that function in fold and in tree-ssa-phiopt. This way you do not have create new trees at all unless
they are needed.

That part would be done as a followup patch. The problem was the combiner copying the RHS of MODIFY_EXPRs as soon as they were encountered rather than as soon as they were needed I have since rewritten it and the problem is gone.


There is also a missed optimization (absolute value) in fold which phiopt catches as fold does
not look at a>0?a:-a; unless you fixed that in your patch.

Yes, I did. The problem is that fold catches A OP B ? C: A but fails to recognize A OP B ? A : C; maybe I will submit this one as a separate patch.


I think there is another missed optimization in fold too for nabs (negative abs): a>0?-a:a;

Yes, the two are related.


Paolo



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