[LLVMdev] Alloca Outside of Entry Block

Mike Stump mrs at apple.com
Wed Aug 13 11:07:27 PDT 2008


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.



More information about the llvm-dev mailing list