I\'m debugging a rather weird stack overflow supposedly caused by allocating too large variables on stack and I\'d like to clarify the following.
Suppose I have the
This optimization is known as "stack coloring", because you're assigning multiple stack objects to the same address. This is an area that we know LLVM can improve. Currently LLVM only does this for stack objects created by the register allocator for spill slots. We'd like to extend this to handle user stack variables as well, but we need a way to capture the lifetime of the value in IR.
There is a rough sketch of how we plan to do this here: http://nondot.org/sabre/LLVMNotes/MemoryUseMarkers.txt
Implementation work on this is underway, several pieces are implemented in mainline.
-Chris