[LLVMdev] Alloca Outside of Entry Block

Dale Johannesen dalej at apple.com
Wed Aug 13 11:19:21 PDT 2008


This is the right answer for C's alloca.  The question probably  
referred to LLVM IR's alloca, however.

On Aug 13, 2008, at 11:07 AMPDT, Mike Stump wrote:

> On Aug 13, 2008, at 10:49 AM, John Criswell wrote:
>> Is it legal to have an alloca in a basic block other than a
>> function's entry block?
>
> How else could you generate code for:
>
> #include <stdlib.h>
>
> void *vp;
> size_t foo(int);
> void watch(void *);
>
> void* bar(int i) {
>   if (i)
>     vp = alloca(foo(i));
>   watch (vp);
> }
>
> ?  The answer should be yes.
> _______________________________________________
> 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