PR other/51165: add new adress_escapes predicate

Richard Guenther richard.guenther@gmail.com
Wed Jan 18 10:15:00 GMT 2012


On Tue, Jan 17, 2012 at 5:41 PM, Patrick Marlier
<patrick.marlier@gmail.com> wrote:
> On 01/17/2012 08:20 AM, Aldy Hernandez wrote:
>>
>> On 01/17/12 03:09, Richard Guenther wrote:
>>>
>>> On Mon, Jan 16, 2012 at 4:58 PM, Aldy Hernandez<aldyh@redhat.com> wrote:
>>>>
>>>>
>>>>> Not really - you handle both ptr and *ptr in the same predicate and
>>>>> call both "address escaped". What I suggested was sth like
>>>>
>>>>
>>>>
>>>> I think I confused myself and you by asking the wrong question in the
>>>> first
>>>> place.
>>>>
>>>> Actually, what I want is to handle VAR_DECL correctly, and your original
>>>> suggestion of using may_be_aliased() fits the bill. The other calls to
>>>> ptr_deref_may_alias_global_p() were fine because we have an SSA_NAME.
>>>>
>>>> We're now down to a one-liner :).
>>>>
>>>> How about this? All TM memory optimization tests fixed, and no
>>>> regressions.
>>>
>>>
>>> Ok. Note that may_be_aliased (x) is also true if x is an automatic
>>> variable
>>> that has its address taken. You can use is_global_var (x) instead if you
>>> only want to test for "global memory".
>>>
>>> Richard.
>>
>>
>> is_global_var is fine. Thanks.
>>
>> Committed.
>
>
> I disagree. is_global_var is already tested just above:
>
>      if (is_global_var (x))
>        return !TREE_READONLY (x);
>
> Which make sense since we don't want to log if it is read-only.
>
> So you can do probably the following:
>
> Index: trans-mem.c
> ===================================================================
> --- trans-mem.c (revision 183253)
> +++ trans-mem.c (working copy)
> @@ -1497,8 +1497,6 @@ requires_barrier (basic_block entry_block, tree x,
>             to needs_to_live_in_memory until we eliminate
>             lower_sequence_tm altogether.  */
>          needs_to_live_in_memory (x)
> -         /* X escapes.  */
> -         || is_global_var (x))

True, because needs_to_live_in_memory is true for all global vars already
(and includes all address-taken automatic vars as well, thus may_be_aliased (x),
too).

Richard.

>        return true;
>       else
>        {
>
> Thanks.
>
> Patrick Marlier.



More information about the Gcc-patches mailing list