[LLVMdev] Non "folding" Stack Allocation

Matthieu Monrocq matthieu.monrocq at gmail.com
Thu Aug 18 09:46:26 PDT 2011


2011/8/17 Chris Lattner <clattner at apple.com>

>
> 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
>
>
Thank you very much for the notes and answer!

--Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110818/94f1b027/attachment.html>


More information about the llvm-dev mailing list