[PATCH] D50104: [OpenCL] Always emit alloca in entry block for enqueue_kernel builtin

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 2 06:50:06 PDT 2018


yaxunl added a comment.

In https://reviews.llvm.org/D50104#1184362, @scott.linder wrote:

> Address feedback; I hope I understood correctly what debug info to check for.
>
> I don't see where in CreateMemTemp and friends EmitLifetimeStart gets called, and I don't see any lifetime intrinsics in the IR even at -O1.


Emitting lifetime intrinsic is optional. In this case, since the life time of the temp var is just before and after the function call, emitting lifetime intrinsics can help optimizers.

It can be done by code like this:

   if (auto *Size = EmitLifetimeStart(
           CGM.getDataLayout().getTypeAllocSize(Alloca.getElementType()),
           Alloca.getPointer())) {
     pushFullExprCleanup<CallLifetimeEnd>(NormalEHLifetimeMarker, Alloca,
                                            Size);
  }

Then the lifetime.start should be emitted before the function call and lifetime.end should be emitted just after the function call.


https://reviews.llvm.org/D50104





More information about the cfe-commits mailing list