[LLVMdev] Code Generation and Alloca

Chris Lattner clattner at apple.com
Fri Aug 15 09:19:38 PDT 2008


On Aug 15, 2008, at 8:40 AM, John Criswell wrote:

> Dear All,
>
> I have a question regarding code generation and alloca.
>
> How important is it to keep allocas in a function's entry block
> consecutive?

It isn't.

> Having consecutive allocas probably makes code generation
> more efficient because the code generator can coalesce them into a
> single add/subtract of the stack pointer on function entry.  Can the
> code generators now coalesce allocas even if they are not consecutive
> within the basic block, or is it still a good idea to keep allocas
> consecutive when doing transforms?

Don't worry about it.  All fixed sized allocas in the entry block are  
folded into the stack adjustment done in the prolog.

-Chris



More information about the llvm-dev mailing list