[PATCH] D37130: [x86] Teach the backend to fold more read-modify-write memory operands to instructions.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 20:41:37 PDT 2017


chandlerc created this revision.
Herald added subscribers: mcrosier, sanjoy.

These can't be reasonably matched in tablegen due to the handling of
flags, so we have to do this in C++ code. We only did it for `inc` and
`dec` historically, this starts fleshing that out to more interesting
instructions. Notably, this handles transfering operands to `add` and
`sub`.

Currently this forces them into a register. The next patch will add
support for keeping immediate operands as immediates. Then I'll extend
this beyond just `add` and `sub`.

I'm not super thrilled by the repeated switches in the code but
everything else I tried was really ugly or problematic.

Many thanks to Craig Topper for the suggestions about where to even
begin here and how to make this stuff work.


https://reviews.llvm.org/D37130

Files:
  lib/Target/X86/X86ISelDAGToDAG.cpp
  test/CodeGen/X86/add.ll
  test/CodeGen/X86/addcarry.ll
  test/CodeGen/X86/fold-rmw-ops.ll
  test/CodeGen/X86/peephole-na-phys-copy-folding.ll
  test/CodeGen/X86/pr32659.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37130.112655.patch
Type: text/x-patch
Size: 20075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170825/acff7902/attachment.bin>


More information about the llvm-commits mailing list