[LLVMdev] Overlapping Allocas

Eli Friedman eli.friedman at gmail.com
Fri Dec 2 14:27:19 PST 2011


On Fri, Dec 2, 2011 at 2:23 PM, John Criswell <criswell at illinois.edu> wrote:
> On 12/2/11 3:24 PM, Eli Friedman wrote:
>>
>> On Fri, Dec 2, 2011 at 1:04 PM, John Criswell<criswell at illinois.edu>
>>  wrote:
>>>
>>> Dear All,
>>>
>>> Is there an optimization in the x86 back-end that could cause two
>>> alloca's to use overlapping memory?
>>
>> It's theoretically possible, but IIRC there isn't any such
>> optimization implemented at the moment.
>
>
> Could the tail call optimization cause something like this?  If there's an
> alloca in a function and the function is called recursively, could tail call
> optimization cause all dynamic instances of the alloca to be allocated in
> the same place on the stack?

Yes, that's possible (although I would expect it to be rare).

-Eli




More information about the llvm-dev mailing list