On Mon, May 9, 2016 at 10:46 AM, Richard Biener
<richard.guent...@gmail.com> wrote:
> On Fri, May 6, 2016 at 11:19 AM, Martin Liška <mli...@suse.cz> wrote:
>> Hi.
>>
>> Honza asked me to explain the change more verbosely.
>> The patch simplify enhances verbose dump of IVOPTS so that
>> # of iterations is printed. Apart from that it also prints
>> invariant expression that are used during the algorithm which
>> considers a set of candidates which is improved.
>>
>> Main motivation for doing this was that sometimes the optimization
>> considers a constant integer as invariant expression (Bin Cheng
>> is working on removal of these) and that both IVs and IE are considered
>> by the cost model to occupy a register. Which is not ideal and
>> it sometimes tend to introduce more IVs that one would expect.
>>
>> === New format ===:
>> Improved to:
>>   cost: 27 (complexity 2)
>>   cand_cost: 11
>>   cand_group_cost: 10 (complexity 2)
>>   candidates: 3, 5
>>    group:0 --> iv_cand:5, cost=(2,0)
>>    group:1 --> iv_cand:5, cost=(4,1)
>>    group:2 --> iv_cand:5, cost=(4,1)
>>    group:3 --> iv_cand:3, cost=(0,0)
>>    group:4 --> iv_cand:3, cost=(0,0)
>>   invariants 1, 6
>>   used invariant expressions:
>>    inv_expr:3:  ((sizetype) _976 - (sizetype) _922) * 4
>>    inv_expr:6:  ((sizetype) _1335 - (sizetype) _922) * 4
>>
>>
>> Original cost 27 (complexity 2)
>>
>> Final cost 27 (complexity 2)
>>
>> Selected IV set for loop 96 at original.f90:820, 5 avg niters, 2 
>> expressions, 2 IVs:
>>
>> === Before ===:
>>
>> Improved to:
>>   cost: 27 (complexity 2)
>>   cand_cost: 11
>>   cand_group_cost: 10 (complexity 2)
>>   candidates: 3, 5
>>    group:0 --> iv_cand:5, cost=(2,0)
>>    group:1 --> iv_cand:5, cost=(4,1)
>>    group:2 --> iv_cand:5, cost=(4,1)
>>    group:3 --> iv_cand:3, cost=(0,0)
>>    group:4 --> iv_cand:3, cost=(0,0)
>>   invariants 1, 6
>>
>> Original cost 27 (complexity 2)
>>
>> Final cost 27 (complexity 2)
>>
>> Selected IV set for loop 96 at original.f90:820, 2 IVs:
>
> But it slows donw compile-time just for enhanced dump files.  Can you
> make the new
> hash-map conditional on dumping?
Hi,

Another way is to remove the use of id for struct iv_inv_expr_ent once
for all.  We can change iv_ca.used_inv_expr and cost_pair.inv_expr_id
to pointers, and rename iv_inv_expr_ent.id to count and use this to
record reference number in iv_ca.  This if-statement on dump_file can
be saved.  Also I think it simplifies current code a bit.  For now,
there are id <-> struct maps for different structures in IVOPT which
make it not straightforward.

Thanks,
bin
>
> Richard.
>
>>
>> Martin

Reply via email to