Replace a LEA instruction of the form 'lea (%esp), %ebx' --> 'mov %esp, %ebx'
MOV is preferable over LEA because usually there are more issue-slots available to execute MOVs than LEAs. Latest processors also support zero-latency MOVs.
Fixes pr29022.
Paths 
  |  Differential  D24705  
[X86] Optimization for replacing LEA with MOV at frame index elimination time ClosedPublic Authored by zvi on Sep 18 2016, 1:26 AM. 
Details Summary Replace a LEA instruction of the form 'lea (%esp), %ebx' --> 'mov %esp, %ebx' MOV is preferable over LEA because usually there are more issue-slots available to execute MOVs than LEAs. Latest processors also support zero-latency MOVs. Fixes pr29022. 
Diff Detail 
 Event TimelineComment Actions Thanks, Zvi! 
 Comment Actions Thanks for the thorough review, Michael. I Will upload a revised patch, 
 zvi updated this object. zvi edited edge metadata. Comment ActionsNew revision addresses all Michael's comments except for the question whether erasing an instruction will invalidate an iterator - i am still looking into this. This revision is now accepted and ready to land.Sep 25 2016, 4:29 AM Closed by commit rL282385: [X86] Optimization for replacing LEA with MOV at frame index elimination time (authored by zvi).  ·  Explain WhySep 25 2016, 11:51 PM This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
Diff 71743 lib/Target/X86/X86RegisterInfo.cpp
 test/CodeGen/X86/avx-intel-ocl.ll
 test/CodeGen/X86/avx512-intel-ocl.ll
 test/CodeGen/X86/dbg-changes-codegen-branch-folding.ll
 test/CodeGen/X86/dynamic-allocas-VLAs.ll
 test/CodeGen/X86/extractelement-index.ll
 test/CodeGen/X86/fast-isel-x86-64.ll
 test/CodeGen/X86/fast-isel-x86.ll
 test/CodeGen/X86/frameaddr.ll
 test/CodeGen/X86/lea-opt-memop-check-1.ll
 test/CodeGen/X86/local_stack_symbol_ordering.ll
 test/CodeGen/X86/pr29022.ll
 
 test/CodeGen/X86/sse-intel-ocl.ll
 test/CodeGen/X86/sse-intrinsics-fast-isel.ll
 test/CodeGen/X86/swift-return.ll
 test/CodeGen/X86/win32_sret.ll
 test/CodeGen/X86/win64_frame.ll
 test/DebugInfo/COFF/inlining.ll
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This should be 'mov %esp, %ebx', without the parens.