alloca and frame pointer changes (regression?)

In the process of moving my backend from release/9.x to release/12.x (not an easy task), I noticed some changes in generated code.

Consider a nested (i.e. not at the out level of a function) alloca of an object (larger than register size). In release/9.x, this did not call for a frame pointer. In release/12.x it does -- but really doesn't need it. This change happens for other architectures as well.

When did this change happen and why?


Can you elaborate on what you mean by a “nested alloca”? Are you saying that this alloca has a known, fixed size, but that it is not in the entry block? If so, it is a dynamic alloca, and yes, it is expected that it will force the use of a frame pointer. If you do not want this behavior, make sure your frontend always places allocas in the entry block.

I can’t say what changed, but the new behavior is expected. Perhaps there used to be some optimization that would hoist these allocas to the entry block, and it got removed or stopped firing for some reason.

I went looking for documentation to explain the concept of a static and dynamic alloca, but it doesn’t exist. o_o