Following up with some of the recent refactoring of MemoryBuiltins, the size and allignment parameters used in heap-to-stack can be removed. This allows heap-to-stack to work with any allocation functions (that allocate undefined or zeroed memory). The alignment is important now because in the past, aligned operator new may not create a properly aligned allocation when being moved to the stack.
There are however a few remaining issues that I would apprecitate someone looking at.
- Is it possible to get away without adding getAllocSizeArgs to MemoryBuiltins. Based on some email conversations that I have had, getObjectSize would be prefered but in this case, we want to get the size arguments even if actual size is not a known constant. It's also used to get one of the types for the memset on line 5999. I don't fully understand what that type is doing so there may be a better way to do that.
- If the alignment is specified but is not a known constant, I use the maximum alignment as the alignment. Is this acceptable or should we use the minimum alignment or perhaps there is some way or change that could allow the alignment to be dynamic.
Please replace this with assert(isAllocationFn()). There's no reason we can't return a result for e.g. op new. The current client won't use it, but we should be generic.