Stefan Strasser wrote:
movl  %ebx, -200(%ebp)
movl  %ebx, -196(%ebp)
movl  %eax, 4(%esp)
movl  -200(%ebp), %edx
movl  -196(%ebp), %ecx

It is hard to say without a testcase, but my first guess would be reload inheritance and/or the post-reload cse pass.


Reload may need to load/store something from a stack slot to satisfy a reload. If we have two instructions in a row that need the same reload, then reload inheritance will try to reuse the value. This may avoid loading it twice and/or storing then reloading a value. If reload inheritance is successful, it then tries to delete the now unnecessary load/store, but this is a complicated operation, and doesn't always succeed. So sometimes we end up with unnecessary loads/stores for partially deleted reloads.

A similar thing might happen if post-reload cse succeeds in simplifying some code, but doesn't succeed in deleting the now unnecessary stack load/store. Deleting a stack slot store is difficult, as it requires memory alias analysis that probably isn't being done in reload and the post-reload cse passes. It is better to avoid creating them in the first place, which is why we have reload inheritance, and why reload is so complicated.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

Reply via email to