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: [patch tree-optimization 1/2]: Branch-cost optimizations


On Mon, Nov 7, 2011 at 8:47 PM, Jeff Law <law@redhat.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 11/07/11 07:38, Richard Guenther wrote:
>>
>>
>> The cond_chain stuff should be as we have discussed quite some
>> time ago on IRC - modeled after tree-affine.c - a "vector" of
>> predicates of the form [~] A op B, combined using logical AND or
>> OR (thus, able to represent a disjunctive or conjunctive normal
>> form). All suitably abstracted so if-conversion, the loop optimizer
>> and loop number of iteration analysis can use this code (they all
>> collect a controlling predicate (chain) and try to simplify against
>> it).
> Hmm, I've never looked at this code, does it do something similar to
> simplify_plus_minus?
>
> simplify_plus_minus takes a hunk of nested additions/subtractions,
> breaks them into components (where subtractions are modeled using
> addition+negation). ?The components are held in an array which is
> repeatedly simplified (combining constants, eliminating unnecessary
> negations, etc etc). ?After simpification we re-emit the new,
> simplified arithmetic?

Yes.  tree-affine does this for a sum of expressions of the form a + b * c.
It collects such sum, optimizes it (and you can add/subtract or scale
these things) and re-emit the new simplified form.

> If so, then definitely, we want that kind of structure. ?Interestingly
> enough Kenner and I discussed this back in the early 90s before I was
> capable of doing anything with trees. ?There was some codegen problem
> on the PA that would have been significantly helped by regrouping of
> this nature at the tree level.

Yes.  Basically allow to operate on on-the-side conjunctive/disjunctive
normal form of predicate compositions (where the predicate atoms
would be for example comparisons or simple SSA names).

Sebastian started to implement a very rough form of that in
tree-if-conv.c (not exactly how I would do it though, and not
general enough).

>> You may, for example, want to pick up my (suspended) work on
>> separating predicate computation from predicate use (or at least
>> think about whether that's a good idea for the purpose of predicate
>> optimizations).
> I certainly see value in in going down this path.

Richard.


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