Code Generation and Alloca

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? 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?

-- John T.

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