[LLVMdev] Alloca Requirements

Duncan Sands baldrick at free.fr
Tue Oct 13 00:44:24 PDT 2009


Hi,

> On Mon, Oct 12, 2009 at 1:07 PM, David Greene <dag at cray.com> wrote:
>> Are there any implicit assumptions about where alloca instructions
>> can appear.
> 
> Static allocas should appear as a continuous chunk in the entry block,
> otherwise other passes might make bad assumptions.

an alloca can appear anywhere, but when they are outside the entry block
then some optimizations may not occur.  The important distinction is
between alloca's that are appear in a loop and those that are not in a
loop.  Rather than detect loops, optimizers tend to just check whether
alloca's are in the entry block or not (the entry block is never part
of a loop).

Ciao,

Duncan.



More information about the llvm-dev mailing list