[cfe-dev] Lambdas and the ABI?

Hubert Tong via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 21 06:45:56 PDT 2017

This question was explored in an other context here:

-- HT

On Tue, Mar 21, 2017 at 9:03 AM, Hal Finkel via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi Richard, Chandler, John, et al.,
> "Quick" question: What aspects, if any, of a C++ lambda (e.g. size,
> layout, alignment) leak into the ABI or are (potentially) semantically
> visible?
> Context...
> We're investigating late lowering/outlining schemes to improve code
> generation for OpenMP and other parallel programming models. One important
> advantage of outlining late is that the IR-level optimizer still has access
> to the pointer-aliasing and loop information from the containing function.
> There are natural benefits to C++ lambdas as well. Lambdas that are used
> "in place" (i.e. only have one call site) should always be inlined, so the
> issues don't come up there, but for lambdas that have multiple call sites,
> or worse, escape (via std::function or some other type-erasure mechanism),
> we can get suboptimal optimization results for the body of the lambda. It
> would seem sad to fix this for OpenMP but not for lambdas.
> However, optimizing before outlining could mean changes in what variables
> need to be captured (not semantically, but at the IR level), and so I'd
> like to think through what would constrain the optimizer's freedom to act
> in this regard.
> John, I'm curious about how this might apply to Objective C blocks as well.
> Thanks again,
> Hal
> --
> Hal Finkel
> Lead, Compiler Technology and Programming Languages
> Leadership Computing Facility
> Argonne National Laboratory
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170321/dd13b394/attachment.html>

More information about the cfe-dev mailing list