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: [4.5] Autoinc support in tree-ssa-loop-ivopts.c


Zdenek Dvorak wrote:
> Hi,
> 
> thanks for looking into the issue.
> 
>> 	(iv_ca_recount_cost): Give a bonus to a candidate/use pair where the
>> 	candidate is used exactly once in the loop in a way that allows
>> 	autoincrement addressing.
> 
> This is a too costly way to implement this idea.  iv_ca_recount_cost is
> called a lot, and the patch adds a quadratic loop (#of candidates * #of
> uses) to it, that furthermore invokes a rather costly computation.
> At the very least you should move the computation to the
> point where USE becomes the single use of CAND.  Also, it should be
> possible to do most of the work of autoinc_possible_at in
> get_computation_cost_at (see the patch proposed for PR 31849 in
> bugzilla for inspiration), and to avoid the code duplication.

I suppose we could have an array that records the possibility of
autoincrement for every cand/use pair, initialize it to all false and
update it in get_computation_cost_at?

> Another thing: is this really the right condition to detect?  I would
> expect autoinc modes to be useful even in cases where more than one
> memory reference and possibly also the exit test are based on the
> autoincremented induction variable. 

Oh, it's not hard to come up with cases this doesn't catch.  However, if
you have multiple memory references, I think it becomes more important
to understand the control flow between them to make an accurate guess.
I'm not claiming that this is perfect, but it's a massive improvement
over the current state.


Bernd
-- 
This footer brought to you by insane German lawmakers.
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif


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