[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp
Chris Lattner
sabre at nondot.org
Mon Jan 17 08:15:30 PST 2005
On Mon, 17 Jan 2005, Alkis Evlogimenos wrote:
> On Monday 17 January 2005 00:48, Chris Lattner wrote:
>> Changes in directory llvm/lib/Target/X86:
>>
>> X86ISelPattern.cpp updated: 1.61 -> 1.62
>> ---
>> Log message:
>>
>> Codegen this:
>>
>> int %foo(int %X) {
>> %T = add int %X, 13
>> %S = mul int %T, 3
>> ret int %S
>> }
>>
>> as this:
>>
>> mov %ECX, DWORD PTR [%ESP + 4]
>> lea %EAX, DWORD PTR [%ECX + 2*%ECX + 39]
>> ret
>>
>> instead of this:
>>
>> mov %ECX, DWORD PTR [%ESP + 4]
>> mov %EAX, %ECX
>> add %EAX, 13
>> imul %EAX, %EAX, 3
>> ret
>
> This doesn't look good: we should have coalesced the load with the move and
> everything should use %EAX. Any idea what is going on?
Yes, currently argument loads cannot be folded into other operations
because the isel assumes they can be used in other BB's. I plan to
eventually add an optimization for arguments that have a single use.
For them, I will emit the load only into the BB that uses the argument,
allowing it to be folded.
-Chris
--
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/
More information about the llvm-commits
mailing list