[PATCH] D101970: [X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 5 19:43:31 PDT 2021


Carrot created this revision.
Carrot added reviewers: craig.topper, spatel.
Herald added subscribers: mstorsjo, pengfei, hiraditya.
Carrot requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch transforms the sequence

      lea (reg1, reg2), reg3
      sub reg3, reg4
  
  to two sub instructions
  
      sub reg1, reg4
      sub reg2, reg4

Similar optimization can also be applied to LEA/ADD sequence.
The modifications to TwoAddressInstructionPass is to ensure the operands of ADD instruction has expected order (the dest register of LEA should be src register of ADD).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101970

Files:
  llvm/include/llvm/CodeGen/TargetInstrInfo.h
  llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
  llvm/lib/Target/X86/X86FixupLEAs.cpp
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/lib/Target/X86/X86InstrInfo.h
  llvm/test/CodeGen/X86/2009-03-23-MultiUseSched.ll
  llvm/test/CodeGen/X86/lea-opt2.ll
  llvm/test/CodeGen/X86/vp2intersect_multiple_pairs.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101970.343272.patch
Type: text/x-patch
Size: 24746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210506/7a71d7c8/attachment.bin>


More information about the llvm-commits mailing list