[PATCH] D45475: [x86] Switch EFLAGS copy lowering to use reg-reg form of testing for a zero register.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 9 23:59:07 PDT 2018


chandlerc created this revision.
chandlerc added a reviewer: craig.topper.
Herald added subscribers: hiraditya, mcrosier, sanjoy.

Previously I tried this and saw LLVM unable to transform this to fold
with memory operands such as spill slot rematerialization. However, it
clearly works as shown in this patch. We turn these into `cmpb $0,
<mem>` when useful for folding a memory operand without issue. This form
has no disadvantage compared te `testb $-1, <mem>`. So overall, this is
likely no worse and may be slightly smaller in some cases due to the
`testb %reg, %reg` form.


Repository:
  rL LLVM

https://reviews.llvm.org/D45475

Files:
  llvm/lib/Target/X86/X86FlagsCopyLowering.cpp
  llvm/test/CodeGen/X86/cmpxchg-clobber-flags.ll
  llvm/test/CodeGen/X86/copy-eflags.ll
  llvm/test/CodeGen/X86/flags-copy-lowering.mir
  llvm/test/CodeGen/X86/peephole-na-phys-copy-folding.ll
  llvm/test/CodeGen/X86/win64_frame.ll
  llvm/test/CodeGen/X86/x86-repmov-copy-eflags.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45475.141796.patch
Type: text/x-patch
Size: 10960 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180410/6d480a56/attachment.bin>


More information about the llvm-commits mailing list