[PR65768] Check rtx_cost when propagating constant

Kugan kugan.vivekanandarajah@linaro.org
Fri Apr 17 03:19:00 GMT 2015



On 15/04/15 21:18, Richard Biener wrote:
> On Wed, Apr 15, 2015 at 11:05 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
>> On Wed, Apr 15, 2015 at 9:53 AM, Kugan wrote:
>>> 2015-04-15  Kugan Vivekanandarajah  < >
>>>             Zhenqiang Chen  <>
>>>
>>>         PR target/65768
>>>         * cprop.c (try_replace_reg): Check cost of constants before propagating.
>>
>>
>>> +
>>> +  /* For CONSTANT_P (to), loop2_invariant pass might hoist it out the loop.
>>> +     And it can be shared by different references.  So skip propagation if
>>> +     it makes INSN's rtx cost higher.  */
>>> +
>>
>> So only undo if the insn is inside a loop (i.e.
>> BLOCK_FOR_INSN(insn)->loop_father != NULL) and this is a
>> post-pass_loop2 cprop run?
> 
> post loop2 loops are destroyed.  When loops are available loop_father
> is always non-NULL, the proper check is for loop_outer (->loop_father) == NULL.
> or loop_depth (->loop_father) != 0.

Thanks Steven and Richard for the comments. If the loop information is
present, we could have used this. But even otherwise, we are just
limiting the cprop of an expensive constant (based on the rtx_cost). I
understand that Richard was a bit concerned about extending the live
range but this is a trade off. As per his previous mail, Zhenqiang did
some benchmarking. I am happy to do further benchmarking if you want to
see that.

Probably the rematerialization that is being introduced in IRA/LRA can
redo this if it sees there is high register pressure. Any thoughts?

Thanks,
Kugan



More information about the Gcc-patches mailing list