This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [4.5] Autoinc support in tree-ssa-loop-ivopts.c
- From: Bernd Schmidt <bernds_cb1 at t-online dot de>
- To: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 17 Feb 2009 18:03:49 +0100
- Subject: Re: [4.5] Autoinc support in tree-ssa-loop-ivopts.c
- References: <4999939F.70405@t-online.de> <20090217163948.GA30309@kam.mff.cuni.cz>
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