[PATCH v3 3/8] tree-object-size: Save sizes as trees and support negative offsets

Siddhesh Poyarekar siddhesh@gotplt.org
Fri Nov 26 18:07:35 GMT 2021

On 11/26/21 23:34, Jakub Jelinek wrote:
> On Fri, Nov 26, 2021 at 11:29:41PM +0530, Siddhesh Poyarekar wrote:
>>>> The trees in object_sizes are each a TREE_VEC with the first element
>>>> being the bytes from the pointer to the end of the object and the
>>>> second, the size of the whole object.  This allows analysis of negative
>>>> offsets, which can now be allowed to the extent of the object bounds.
>>>> Tests have been added to verify that it actually works.
>>> If you need pairs of trees, just use pairs of trees, using TREE_VEC for it
>>> will create lots of extra garbage.
>>> Either std::pair<tree, tree>, but most likely gengtype won't handle that
>>> right, so just create your own
>>> struct GTY(()) whatever {
>>>     /* Comment explaining what it is.  */
>>>     tree whatever1;
>>>     /* Comment explaining what it is.  */
>>>     tree whatever2;
>>> };
>>> and if that needs to go into e.g. object_sizes vectors, use vec<whatever>.
>> Got it, I'll make a new struct GTY(()).  I'm also using TREE_VEC to store
>> PHI nodes args and the result (in patch 5/8) until they're emitted in
>> gimplify_size_expressions.  It needs to be a tree since it would be stored
>> in whatever1 and whatever2, would that be acceptable use?
> Maybe yes, I'll need to look at it.  What I didn't like is using TREE_VEC
> for something that will come in pairs all the time.

Ah ok, I understand your concern better now, thanks.


More information about the Gcc-patches mailing list