On 8/23/23 11:19, Mark Brown wrote:
On Wed, Aug 23, 2023 at 03:49:58PM +0000, Charles Keepax wrote:
On Wed, Aug 23, 2023 at 10:21:13AM +0100, Charles Keepax wrote:
Commit ac950278b087 ("ASoC: add N cpus to M codecs dai link support") added an additional local params in __soc_pmc_hw_params, for the CPU side of the DAI. The snd_pcm_hw_params struct is pretty large (604 bytes) and keeping two local copies of it makes the stack frame for __soc_pcm_hw_params really large. As the two copies are only used sequentially combine these into a single local variable to shrink the stack frame.
Hmm... this might need a little more thought its not clear why this should change the frame size and it only seems to change the frame size on the ARM cross compiler I am using, not x86.
Isn't that just going to be a function of the compiler being smart enough to work out that there aren't overlapping uses of the two variables and they can share stack space? There's no reason not to help it figure that out.
One would think that compilers understand the variable scope, and free-up the stack when leaving a for loop scope?