[PATCH] [X86] New pass that moves immediate operands to registers.
peter_cooper at apple.com
Tue Sep 30 11:31:36 PDT 2014
Hi Serge, Quentin
In the specific example here for the constant 0, i’d have expected to see xor used to create the 0. Any idea why that didn’t happen? That would improve the code size which Quentin mentioned is a plus for this.
Also, i’ve sometimes seen neighboring 0’s being written of different sizes. Would it be possible (perhaps in a future patch), to turn
movq 0, 0x0(%rsi)
movl 0, 0x8(%rsi)
xor %rax, %rax
movq %rax, 0x0(%rsi)
movl %eax, 0x8(%rsi)
> On Sep 30, 2014, at 6:50 PM, Quentin Colombet <qcolombet at apple.com> wrote:
> Hi Serge,
> 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
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits