rjmccall added a comment.

In https://reviews.llvm.org/D45900#1093154, @yaxunl wrote:

> In https://reviews.llvm.org/D45900#1083377, @rjmccall wrote:
>
> > Oh, I see, it's not that the lifetime intrinsics don't handle pointers in 
> > the alloca address space, it's that we might have already promoted them 
> > into `DefaultAS`.
> >
> > Do the LLVM uses of lifetime intrinsics actually look through these address 
> > space casts?  I'm wondering if we might need to change how we emit the 
> > intrinsics so that they're emitted directly on (bitcasts of) the underlying 
> > allocas.
>
>
> Some passes do not look through address space casts. Although there is 
> InferAddressSpace pass which can eliminate the redundant address space casts, 
> still it is desirable not to emit redundant address space in Clang.
>
> To avoid increasing complexity of alloca emitting API, I think we need a way 
> to track the original alloca and the alloca casted to default address space. 
> I can think of two ways:
>
> 1. add OriginalPointer member to Address, which is the originally emitted 
> LLVM value for the variable. Whenever we pass the address of a variable we 
> also pass the original LLVM value.
> 2. add a map to CodeGenFunction to map the casted alloca to the real alloca.
>
>   Any suggestion? Thanks.


Can we just call CreateLifetimeStart (and push the cleanup to call 
CreateLifetimeEnd) immediately after creating the alloca instead of waiting 
until later like we do now?

Modifying Address is not appropriate, and adding a map to CGF would be big 
waste.


https://reviews.llvm.org/D45900



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to