[PATCH] D15393: [X86] Order the local stack symbols to improve code size and locality.
Zia Ansari via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 9 16:15:26 PST 2015
zansari added a comment.
In http://reviews.llvm.org/D15393#306468, @hans wrote:
> This looks very interesting.
>
> Maybe update the commit message and/or add to the comments in the file why this is beneficial for code size, since it wasn't obvious for me at least. Do I understand correctly that the idea is that addressing objects closer to %esp generally requires less code because it can use a tighter addressing mode?
Hi Hans.. Thanks for the review.
Yes, sorry I didn't make that clear in the description. The saving are from allocating more frequently (statically) accessed addresses closer to sp/fp and saving 3-4 bytes of address encoding by doing so.. For example, if a large array is allocated early on the stack and only accessed once, that would cause all other symbols on the stack to cost an extra 3-4 bytes to access, which is a fair bit of bloat if they're accessed frequently.
Hope that helps.
http://reviews.llvm.org/D15393
More information about the llvm-commits
mailing list