[PATCH] [X86] New pass that moves immediate operands to registers.
qcolombet at apple.com
Tue Sep 30 10:50:49 PDT 2014
The constant hoisting pass does this kind of things. Should we try to teach it to handle this kind of cases?
Moreover, this may be beneficial for code size, but I guess it is generally not beneficial for performances. Therefore, I believe this should be done for functions with the Os or Oz attributes only.
CC’ed Juergen to have his thoughts on the constant hoisting stuff.
On Sep 30, 2014, at 10:24 AM, Serge Pavlov <sepavloff at gmail.com> wrote:
> The pass scans machine instructions looking for uses of immediate
> values. If the same value is used in neighbouring instructions, it
> is moved to a register, if this is possible and reduces code size.
> For instance, instructions
> mov $0, 0x4(%esi)
> mov $0, 0x8(%esi)
> can be replaced by
> mov $0, %eax
> mov %eax, 0x4(%esi)
> mov %eax, 0x8(%esi)
> which is shorter in code size.
> This patch fixes PR5124, it uses feedback on the previous patch discussed in the thread
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130916/188079.html .
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
More information about the llvm-commits