[LLVMdev] Alloca Requirements

Lennart Augustsson lennart at augustsson.net
Tue Oct 13 02:02:44 PDT 2009


And you really want your allocas in the entry block so they are
implemented by just stack pointer manipulation rather than calling
alloca().  The latter is slower, and there's also a bug that makes
calling alloca() not getting the alignment right (if it's > 8).

On Tue, Oct 13, 2009 at 9:44 AM, Duncan Sands <baldrick at free.fr> wrote:
> 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.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list