[LLVMdev] issues with my DYNAMIC_STACKALLOC impl

Eli Friedman eli.friedman at gmail.com
Mon Jan 12 10:41:32 PST 2009


On Mon, Jan 12, 2009 at 8:26 AM, Villmow, Micah <Micah.Villmow at amd.com> wrote:
> I have a very simple kernel that exposes a bug in the backend I am working
> on and I cannot figure out how to fix the problem. I've narrowed down the
> issue to be with dynamic stack allocation. The problem I am having is that
> if I declare a variable inside of the loop, the code that my backend
> generates produces incorrect results; however, if I move this declaration
> outside of the loop the generated code works correctly.

I haven't looked carefully, but alloca's outside of the entry block
are treated significantly differently from those outside of it.  The
issue is that the loop could capture the pointer, so it needs a new
memory location every trip through the loop.

> I've attached the two files two files.
>
> My backend does not have a stack pointer and no memory allocations.

If you can't do allocation, you shouldn't try to deal with IL with
allocas outside of the entry block.

-Eli



More information about the llvm-dev mailing list