At what moment is memory typically allocated for local variables in C++?

后端 未结 5 816
故里飘歌
故里飘歌 2021-01-01 11:04

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

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-01 11:16

    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

提交回复
热议问题