[PATCH] D12455: [IR] Teach `llvm::User` to co-allocate a descriptor.

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 15:38:45 PDT 2015


> On Sep 2, 2015, at 3:34 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
> 
> On Wed, Sep 2, 2015 at 3:30 PM, Pete Cooper <peter_cooper at apple.com> wrote:
>> 
>>> On Sep 2, 2015, at 3:20 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
>>> 
>>> sanjoy added a comment.
>>> 
>>> @pete - can you please take a look to see if you're okay with how I've specialized `operator new`?
>> The implementation generally looks good with just one question.
>> 
>> Can you check to see if allocateFixedOperandUser can just be static inline in User.cpp and avoid the declaration in User.h?
> 
> That's exactly what I tried first. :)  The problem with that is that
> the fields it needs to populate in the allocated User instance are
> protected, so that leaves me with either
Ah, yeah that make sense.  What you have is good.

So LGTM just in case the above didn’t make that clear.

Pete
> 
> - make allocateFixedOperandUser a friend, which IMHO is even uglier
> than what I have now
> or
> - copy the stores to the fields in the User instance to the operator
> new implementations, in which case the benefit of a shared
> implementation is lost
> 
> -- Sanjoy
> 
> 
>> 
>> Otherwise LGTM.
>> 
>> Thanks,
>> Pete
>>> 
>>> 
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D12455&d=BQIFaQ&c=eEvniauFctOgLOKGJOplqw&r=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=Xw5go3ocA3WFS9VUceYGLOtQZatFzfVq0EIKS_CkaaY&s=7bd4hN0eD59OPZIU3JMqMub6oRpT45d4V4D6bIWGGTo&e=
>>> 
>>> 
>>> 
>> 
> 
> 
> 
> -- 
> Sanjoy Das
> https://urldefense.proofpoint.com/v2/url?u=http-3A__playingwithpointers.com&d=BQIBaQ&c=eEvniauFctOgLOKGJOplqw&r=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=GIjYR0DbI763ZLvVPqyAz9DZifn947m3x9noNtuEJ3Q&s=NFbctN0H1KIROV9nQdWEORaP_BJh9-KYdiaFlbNIvpA&e= 



More information about the llvm-commits mailing list