I wanted to mention that I’m planning to start writing and sending out patches for this.
Naming the attribute ‘alloca’ was really confusing, so I’d like to change it to ‘inalloca’, which follows the preposition pattern of inreg and byval.
After discussion, we decided it was silly to add stackbase uses to alloca instructions. They should stay simple.
Instead, we’ll clarify that it is illegal for an optimization to raise an alloca used as an inalloca argument across a stacksave, and fix any transforms that do this. In particular, I’ll look at the inliner, which is the most likely to move allocas.
Furthermore, any call that uses an inalloca argument must have an associated stackrestore field, regardless of whether it’s callee cleanup (thiscall) or caller cleanup (cdecl). The backend will be responsible for restoring the stack pointer on both return and exception edges.