[LLVMdev] lifetime.start/end clarification

Reid Kleckner rnk at google.com
Wed Nov 5 10:10:00 PST 2014


On Wed, Nov 5, 2014 at 10:01 AM, Philip Reames <listmail at philipreames.com>
wrote:

>  Would one of you mind taking a step back and explaining what you believe
> the "stack colouring problem" to be?  I'm familiar with the general meaning
> of the term and even some of LLVM's implementation; I'm just not sure what
> specific issue you're referring to.   Having the context would make it much
> easier to assess your proposals.
>

The goal of stack coloring is to reduce stack usage by storing user data
with non-overlapping lifetimes in the same stack memory.

C/C++ source programs usually have a naturally scoped structure, where the
lifetime of data is bounded by curly braces. This information reduces the
lifetime that stack coloring sees, so it saves stack memory.

When we go to LLVM IR, we lose all that information. We currently try to
recapture it with calls to @lifetime.start / end intrinsic calls at the
point of declaration and when the variable falls out of scope. Basically
we're trying to figure out how to put that scoping information back into
the IR without turning it back into a tree.

Furthermore, if we had better information about this in the IR, we could
augment ASan to detect use-after-scope.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141105/79547fa9/attachment.html>


More information about the llvm-dev mailing list