[LLVMdev] Non "folding" Stack Allocation

Chris Lattner clattner at apple.com
Wed Aug 17 11:22:01 PDT 2011


On Aug 17, 2011, at 5:02 AM, Matthieu Monrocq wrote:

> My surprise stems from the fact that Clang/LLVM seems to reserve (at least in its bytecode) space for all temporary variables, not taking into account that some are mutually exclusive. I would have expected the space to be folded. However, since this is LLVM IR, and not the final assembly, and since LLVM IR is strongly typed, it makes sense to keep them separated.
> 
> Therefore I was wondering if in the x86 representation (say) these would be folded, and if so what is the name of the Optimization/CodeGen pass responsible ?

I commented on stack overflow.  The rough plan of record is captured here:
http://nondot.org/sabre/LLVMNotes/MemoryUseMarkers.txt

The basic idea is that we capture the lifetime of the memory object in IR, then have the code generator allocate multiple alloca's with non-overlapping lifetimes to the same stack offset.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110817/6071351f/attachment.html>


More information about the llvm-dev mailing list