On 2023-08-17 17:25, Qing Zhao wrote:
It's not exactly the same issue, the earlier discussion was about choosing sizes in the 
same pass while the current one is about choosing between passes, but I agree it 
"rhymes".  This is what I was alluding to originally (for OST_MINIMUM use 
MIN_EXPR if both passes returned a pass) but I haven't thought about it hard enough to be 
100% confident that it's the better solution, especially for OST_MAXIMUM.

We have two different sources to get SIZE information for the subobject:

1. From the TYPESIZE information embedded in the IR;
2. From the initialization information propagated from data flow, this includes 
both malloc call and the DECL_INIT.

We need to choose between these two when both available, (these two information 
could be
  in the same pass as we discussed before, or in different passes which is 
shown in this discussion).

I think that the MIN_EXPR might be the right choice (especially for 
OST_MAXIMUM) -:)

It's worth a shot I guess. We could emit something like the following in early_object_sizes_execute_one:

  sz = (__bos(o->sub, ost) == unknown
        ? early_size
        : MIN_EXPR (__bos(o->sub, ost), early_size));

and see if it sticks.

Thanks,
Sid

Reply via email to