[llvm] r176408 - recommit r172363 & r171325 (reverted in r172756)

Arnold Schwaighofer aschwaighofer at apple.com
Mon Mar 4 10:47:15 PST 2013


On Mar 4, 2013, at 12:21 PM, Dan Gohman <dan433584 at gmail.com> wrote:

> Hello,
> 
> I haven't been following this issue closely, but this documentation patch confuses me.
> 
> > The object pointer can also point to several underlying objects.
> +If the same same size can be determined, a valid size will be returned.
> 
> > +the size of the object (or several underlying objects) concerned. If the size
> > +cannot be determined at compile time, ``llvm.objectsize`` returns
> > +``i32/i64 -1 or 0`` (depending on the ``min`` argument).
> 
> For the sense of "object" which I believe is being used here (a whole allocation) pointers never point to several underlying objects at the same time. Phi nodes and other things allow pointers to point to different objects each time they are evaluated, but each time they are evaluated, they only point to (at most) one object. This is true for all instructions which use pointers, so there's no reason to special case here.
> 

Yes, thinking a little longer about it - you are absolutely right. I was thrown off track by the following sentence.

"An object in this context means an allocation of a specific class, structure, array, or other object."

This short wired my brain into thinking over all paths in the function you can only have one object.

As you point out this is the wrong way of thinking about it. It is for every individual evaluation of the graph we are talking here.




> From scanning the emails, it seems the main source of confusion here is about the different kinds of information that API consumers want. Some consumers want to know the maximum distance from the pointer to the end of the allocation. Some consumers want to know the maximum size of the entire allocation. Possibly other consumers want other things. But as long as these needs are all kept distinct, all of these consumers should be ok with the analysis looking through Phi nodes.

Yes, agreed.



More information about the llvm-commits mailing list